CAN bus/What CAN is/01. Two wires, many boards
What CAN is · 01 of 9

Two wires, many boards

CAN is two wires that every board on the bus shares as an equal. There is no master: any board can start a message, every board hears every message, and when two start at once the bus itself decides who goes first. A 0 is driven and a 1 is left alone, and that one rule is where everything else comes from.

Two wires, a difference

CAN sends each bit on two wires, CANH and CANL, and the receiver reads the difference between them. Noise that reaches the cable lands on both wires alike and cancels in the difference, which is why CAN runs in cars and factories, next to motors, for tens or hundreds of metres.

A 0 is driven, a 1 is left alone

That is the rule that makes CAN different. To send a 0 a board drives the wires apart: CANH up, CANL down, about 2 V between them. That is called dominant. To send a 1 a board lets go. The wires drift back together, pulled by the resistors at the ends of the bus, and the difference falls to nothing. That is recessive.

Dominant and recessive
bus reads 0
Board A sends
Board B sends
CANH − CANL
about 2.0 V
Every receiver reads
0
Reads 0 from
900 mV
One 0 beats one 1. The board sending 1 only lets go; the one sending 0 drives. So the bus is 0, and the board that sent 1 reads back a 0 it did not send. That mismatch is not an error: it is how CAN decides who talks, in the next chapter.

Two boards can drive the bus at the same moment without harm. If any board drives a 0, the bus is 0; it is 1 only when every board lets go. Every board also reads the bus while it sends, so a board that sends a 1 and reads back a 0 knows at once that somebody else is talking.

What that buys

  • No master. Any board can start a message whenever the bus is idle.
  • No collisions lost. When two start together, the bus decides who goes first without spoiling either message: Dominant wins.
  • Every message checked. Every frame carries a checksum and must be acknowledged by another board: Every message is acknowledged.

None of that is in your sketch. It is done by the CAN controller inside your microcontroller, and this block is the part between that controller and the two wires.

When it does not work

Is CAN the same as RS485?

Both send a difference down two wires, and that is where the likeness ends. RS485 is only a way to move bits: who talks when is up to your sketch. CAN adds the rules in hardware: messages with identifiers, the bus deciding who goes first, every message acknowledged and checked. The CAN controller in your microcontroller does all of that.

Do I need a master board?

No. Every board on a CAN bus is equal: any of them can send whenever the bus is free, and every one receives everything. A sketch that listens for one identifier and ignores the rest is how a board picks its own messages.

Is this the CAN in my car?

The same physical layer, ISO 11898-2 high-speed CAN, so the voltages are the same. But a car's bus runs its own bit rate and messages, and a wrong frame on it can upset real systems. Learn on your own bench bus first, and only listen, never send, on a vehicle.

Where this goes next

Four pins to your microcontroller, three to the bus, and what the board does not bring.

What is on the board

Edit this page — content/books/can-bus/two-wires-many-boards.mdx

Community

Questions about this product

See what other owners have asked, and read their solutions.

Ask a question ↗

CAN Bus

Loading discussions…

Discuss this article

Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.

Browse Modules and blocks on the forum