CAN Arbitration Simulation
See bit by bit who gets to transmit when several controllers start sending on a CAN bus at the same moment. Find out why the smaller ID wins and how the losers back off without corrupting the frame.
Loading the 3D scene
Controls
Bus waveform 11 ID bits
The top three rows are what each controller sent and the bottom row is the bus. Red marks show where a controller lost.
Measurements
- Winner this round
- -
- Deciding bit
- -
- Transmission order
- -
- Controllers left
- 3
Try this
- Three controllers share two wires, CAN_H and CAN_L. The 11 small cells in front of each controller are the ID bits of the message it wants to send. Bright cells are 0 and dark cells are 1.
- Press Send together. All three put their ID on the bus one bit at a time, most significant bit first. The bottom row is the value that actually appears on the bus.
- On the bus, 0 beats 1. If any controller sends 0, the bus is 0. A controller that sent 1 but reads 0 knows it has lost and stops transmitting at once.
- The controller left at the end sends the rest of its data. The losers compete again automatically once the bus is free. "Transmission order" fills in from the smallest ID.
- Change the IDs. A smaller number has more zeros in the upper bits and wins first. That is why urgent messages are given small IDs on CAN.
- Give two controllers the same ID and arbitration ends without a winner. On a real bus they then collide in the data that follows and an error results. This is why IDs must not be duplicated on one bus.
How to read it
On CAN, 0 is called dominant and 1 recessive. A dominant bit drives the two wires apart, while a recessive bit does nothing. So when anyone sends dominant, the whole bus is dominant.
A controller reads the bus while it transmits. If the bus differs from what it sent, it backs off. The winner's frame is not damaged by a single bit, so nothing has to be resent.
This lab covers only the arbitration field of an 11-bit standard ID. Bit stuffing, CRC and ACK are left out.
This lab is also available in Korean. More labs: all 3D labs.