CAN Bus Arbitration: How CSMA/CA and Bitwise Arbitration Decide Who Sends

Key takeaways

  • CAN resolves collisions without destroying data. The lower-priority node stops and the higher-priority message continues.
  • The message ID is the priority. Nodes compare it bit by bit, and the lowest ID wins.
  • A node may send again once the bus is idle, after 11 consecutive recessive bits.
Light trails from traffic on a curving highway at night, with the words CAN Arbitration
Traffic light trails on a curving highway at night. Image: Techqio

CAN bus arbitration settles a collision without throwing any data away. When two nodes start sending at the same moment, the one with the lower-priority message stops and the other message goes through intact. Early Ethernet handled the same collision by cancelling the data and sending it again.

Both are bus access methods. A bus access method decides which sending node gets to occupy the bus while messages are being transmitted.

Four common bus access methods

There are four typical ways to decide who occupies a bus. CAN belongs to the fourth.

1. Master-slave method

In the master-slave method, the master controls message transmission. A slave node occupies the bus only briefly, and only when it has to answer the master.

Diagram titled The master decides who talks: a highlighted Master layer that controls every message transfer above three slave layers that answer only when the master asks
A master layer above three slave layers. Image: Techqio

2. Time-synchronous method

The time-synchronous method gives each node a set amount of time, repeated periodically, in which it may send a message.

3. Token-passing method

Token passing works with a token, which is the right to occupy the bus. The token is handed from one node to the next in order.

Diagram of six numbered computers on a ring, with arrows pointing one way around it and an orange token moving from node 1, which holds the bus, toward node 2
Six nodes on a ring passing a token in order. Image: AI-generated with ChatGPT

4. Event-driven method

In the event-driven method, each electronic control unit (ECU) on the bus can access it at any time, as long as the bus is idle. Once one node occupies the bus, the others have to wait until it returns to idle.

The two best-known event-driven methods are CSMA/CD and CSMA/CA. CSMA stands for Carrier Sense Multiple Access and describes the situation where several nodes want the bus. CD is Collision Detection and CA is Collision Avoidance, and each names what the nodes do in that situation.

CSMA/CD vs. CSMA/CA: what Ethernet and CAN do after a collision

Like the early Ethernet bus, a CAN bus puts every device on the network in an equal position. All of them therefore follow one rule that keeps data from colliding in transit. Ethernet used CSMA/CD, and CAN uses CSMA/CA.

Slide titled CSMA/CD, Carrier Sense Multiple Access with Collision Detection: four computers on one wire with a red collision burst between two of them, and the text that each computer first senses if the wire is idle and that two computers sending at the same time collide
Four computers on one wire with a collision burst. Image: PowerCert Animated Videos (YouTube)

Both start the same way. Before sending, a node senses the network to check whether data is already in transit, which is the CSMA part. The two systems part ways when a node judges the network empty, starts sending and collides anyway.

An Ethernet bus uses a jam signal to invalidate the data in transit, then tries to resend what failed. The station stops its frame, sends the jam signal and waits a random interval before resending. That is the CD, or collision detection, method.

A CAN bus invalidates nothing. It goes by the priority of the colliding data, so the higher-priority message is the one that finally gets sent. The node sending the lower-priority message stops at once and avoids the collision, which CAN calls the CA, or collision avoidance, method.

How CAN bus arbitration picks a winner

Slide titled Arbitration: bit traces for Node A (ID 1199), Node B (1530), Node C (1201) and the CAN bus. Node B loses arbitration first, then Node C, each where it transmits recessive but the bus is dominant, and both are marked no longer transmitting
Bit traces of nodes A, B and C above the bus level. Image: Texas Instruments (YouTube)

The three-node trace above, from Texas Instruments’ CAN protocol video, shows CAN bus arbitration when nodes start at the same moment. A node drops out where it transmits a recessive 1 but reads a dominant 0 on the bus. Node B (ID 1530) drops out first and Node C (ID 1201) a few bits later, while Node A, with the lowest ID (1199), finishes its identifier alone.

TI’s CAN primer files the same behavior under another name. It calls the protocol CSMA/CD+AMP, carrier sense multiple access with collision detection and arbitration on message priority. Under either label, the collision is settled by bitwise arbitration on the priority in each message’s identifier field.

Every message in CAN communication gets an ID. The message ID serves as its priority and is assigned by how important the message is. The lower the ID, the higher the priority, and every device lets the more important message go first. If the bus could be reached from outside the vehicle, I’d worry that this priority is taken on trust, because the protocol has no message authentication.

Slide titled Sample CAN frame: the 11-bit message identifier field highlighted in yellow, with the text that it represents message priority, indicates the target of the message and is where arbitration occurs
The 11-bit ID field highlighted in a sample frame. Image: Texas Instruments (YouTube)

The time spent comparing message IDs, and with them priorities, is called the arbitration phase. The newest generation keeps that idea. CAN XL, standardized in ISO 11898-1:2024, carries an 11-bit priority ID whose only job is to set the frame’s priority.

Once in the arbitration phase, a sending node compares the bit it is sending with the bit on the bus, one bit at a time. It is checking for a message request with a higher priority than its own. A node that was sending the lower-priority message stops or postpones its transmission, and the higher-priority message keeps the bus. This process is called bitwise arbitration.

Each time a bit goes onto the bus during the arbitration phase, the CAN transceivers of the connected nodes make that comparison. A node that finds a lower bit value than its own on the bus, a dominant 0, concludes that its priority is lower. It stops or postpones the message it was sending.

Bus idle and the start-of-frame bit

A complete CAN frame bit by bit above oscilloscope traces of CAN RX, CAN H and CAN L: a dominant start-of-frame 0, the arbitration, control, data and CRC fields, then the ACK delimiter, seven end-of-frame bits and three interframe bits, all recessive 1s
A complete frame, bit by bit, above its bus traces. Photo: Dr Ken Tindell / Wikimedia Commons (CC BY-SA 4.0)

A message can be sent again only after the bus returns to idle, the state in which no message occupies the bus. CAN judges the bus idle and ready for a transmission after 11 consecutive recessive (1) bits. Every CAN message then begins with a dominant (0) bit that announces the start of transmission. That bit is the start-of-frame bit, or SOF bit.

Most of that recessive run comes from the end of the previous frame. TI’s primer lists a one-bit ACK delimiter and a 7-bit end-of-frame field, and CiA describes a 3-bit intermission as the minimum gap between consecutive frames. That adds up to 11.

Why bitwise arbitration needs a slow bus

Timing decides who gets the bus. When different message requests arrive in the message ID field, the arbitration phase, the higher-priority message occupies the bus. If a second request arrives after the arbitration phase, the later one is postponed regardless of its priority.

Bar chart of approximate maximum CAN cable length by bit rate, from Kvaser: 130 ft (40 m) at 1 Mbit/s, 330 ft (100 m) at 500 kbit/s, 650 ft (200 m) at 250 kbit/s and 1,600 ft (500 m) at 125 kbit/s
Bar chart of maximum cable length at four bit rates. Image: Techqio. Source: Kvaser CAN protocol tutorial (approximate maximum cable lengths)

Bitwise arbitration is possible because CAN is a low-speed network. Each bit lasts long enough for every node on the bus to compare the message ID position by position. The signal has to reach the most remote node and come back, so Kvaser’s approximate cable limits grow as the bit rate falls.

  • 1 Mbit/s: about 130 ft (40 m)
  • 500 kbit/s: about 330 ft (100 m)
  • 250 kbit/s: about 650 ft (200 m)
  • 125 kbit/s: about 1,600 ft (500 m)

That is the trade CAN bus arbitration makes. Arbitration never interrupts or resends the winning message, and the bus pays in bit rate and cable length. A message’s ID is therefore a timing decision, since a low ID never waits behind a higher one starting with it. I’d pick the bit rate only after the bus length is known, because the fastest setting fits just the shortest cable.

Sources

Share this article

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *