﻿ Priority and arbitration | Kickoff

# Priority and arbitration

10 May

Priority and arbitration: When two or more CAN devices attempt to transmit at the same time, the collision will be detected and resolved using Carrier Sense Multiple Access with Arbitration on Message Priority (CSMA/AMP) protocol. What this means is that the message with the highest priority will be transmitted while all messages of a lower priority will stop. The priority of a message is determined by the message ID; lower numbers have a higher priority. Here is how this works. Recall that all CAN devices are connected to the bus in a wired-AND configuration and that the recessive state of the CAN bus is a logic 1. Each node will transmit its 11-bit identifier on the bus, one bit at a time starting with the most significant bit. While transmitting, the CAN node will monitor the bus state to determine if it has successfully driven the bus to the proper value. If one device is trying to write a logical 1 (recessive) while another is trying to write a logical 0 (dominant) then the dominant state will have priority. The device(s) writing the logical 1 will abort transmission until the bus goes idle again. This will continue on each bit until the device with the lowest ID (the highest priority) is the only device left transmitting on the bus.

﻿For example, consider three CAN devices each trying to transmit messages:

﻿•  Device 1 – address 433 (decimal or 00110110001 binary)
•  Device 2 – address 154 (00010011010)
•  Device 3 – address 187 (00010111011)

Assuming all three see the bus is idle and begin transmitting at the same time, this is how the arbitration works out. All three devices will drive the bus to a dominant state for the start-of-frame (SOF) and the two most significant bits of each message identifier. Each device will monitor the bus and determine success. When they write bit 8 of the message ID, the device writing message ID 433 will notice that the bus is in the dominant state when it was trying to let it be recessive, so it will assume a collision and give up for now. The remaining devices will continue writing bits until bit 5, then the device writing message ID 187 will notice a collision and abort transmission. This leaves the device

﻿Figure 12-9. Device arbitration example.
writing message ID 154 remaining. It will continue writing bits on the bus until complete or an error is detected. Notice that this method of arbitration will always cause the lowest numerical value message ID to have priority. This same method of bit-wise arbitration and prioritization applies to the 18-bit extension in the extended format as well.

Random Posts