Walk through CAN arbitration with a concrete bit-by-bit example.
CAN uses CSMA/CR (Carrier Sense Multiple Access with Collision Resolution) — nodes listen for an idle bus, then begin transmitting simultaneously. Arbitration happens non-destructively on the identifier field, exploiting the physical property that a dominant bit (0) always overrides a recessive bit (1) on the open-collector/open-drain bus.
Consider three nodes transmitting simultaneously:
- Node A: ID = 0x64A =
0b110 0100 1010 - Node B: ID = 0x649 =
0b110 0100 1001 - Node C: ID = 0x658 =
0b110 0101 1000
Bit-by-bit (MSB first, bit 10 down to bit 0):
| Bit | A sends | B sends | C sends | Bus | Result |
|---|---|---|---|---|---|
| 10 | 1 | 1 | 1 | 1 | All match — continue |
| 9 | 1 | 1 | 1 | 1 | All match — continue |
| 8 | 0 | 0 | 0 | 0 | All match — continue |
| 7 | 0 | 0 | 0 | 0 | All match — continue |
| 6 | 1 | 1 | 1 | 1 | All match — continue |
| 5 | 0 | 0 | 0 | 0 | All match — continue |
| 4 | 0 | 0 | 1 | 0 | C loses — C sent 1 (recessive) but read 0 (dominant). C stops transmitting. |
| 3 | 1 | 1 | — | 1 | A and B match — continue |
| 2 | 0 | 0 | — | 0 | A and B match — continue |
| 1 | 1 | 0 | — | 0 | A loses — A sent 1 but read 0. A stops. |
| 0 | — | 1 | — | 1 | B wins — sole remaining transmitter |
Node B has the lowest identifier (0x649) and wins arbitration. Its frame is transmitted without any corruption or delay. Nodes A and C become receivers and retry their transmissions after the bus returns to idle. The key insight: lower ID = higher priority, and the winning node never even knows that arbitration occurred — from its perspective, every bit it sent appeared correctly on the bus.
This is why message identifiers in CAN are not arbitrary — they must be carefully assigned based on the priority requirements of each message. Safety-critical messages (brake commands, airbag triggers) are assigned the lowest IDs.
Source: CAN Q&A
