In this lesson, you will learn how the CAN bus uses numerical identifier values to ensure that the most urgent messages always win the right to transmit on the bus.
The Logic of Dominant and Recessive Bits
Unlike SPI or I2C, where a master dictates the flow, CAN is a multi-master broadcast protocol. When multiple nodes want to send a message simultaneously, they begin transmitting their Identifiers (IDs) bit-by-bit.
The electrical rule of the CAN bus is simple: a 0 (Dominant) overwrites a 1 (Recessive). If one node sends a 0 and another sends a 1, the bus voltage settles into the Dominant state. Every node monitors the bus while transmitting; if a node sends a 1 but detects a 0 on the line, it realizes a higher-priority message is being sent and immediately stops transmitting to try again later.
Calculating Arbitration Winners
Because 0 is dominant and 1 is recessive, a lower numerical value for an Identifier is inherently more "dominant" than a higher one. The node with the lowest ID value effectively "wins" the arbitration process because it puts a 0 on the bus earlier in the bit stream than nodes with higher IDs.
Consider two nodes attempting to transmit at the same time:
- Node A (Priority Message): ID =
0x0A(Binary:0000 1010) - Node B (Low Priority): ID =
0x0C(Binary:0000 1100)
Both nodes transmit the first four bits (0000) successfully. At the fifth bit position:
- Node A sends a
1(Recessive). - Node B sends a
1(Recessive). - Both continue.
At the sixth bit position:
- Node A sends a
0(Dominant). - Node B sends a
1(Recessive).
Node B detects that the bus is at a 0 even though it tried to send a 1. Node B immediately goes silent, allowing Node A to complete its transmission. By assigning critical data (like an emergency brake signal) a low numeric ID (e.g., 0x01), you guarantee it will always win arbitration over routine diagnostic data (e.g., 0x7FF).
Key Takeaway: In CAN arbitration, the lowest numerical Identifier acts as the highest priority because the bit-wise "0" (Dominant) state suppresses any "1" (Recessive) state during transmission contention.