CAN
A two-wire bus where the lowest ID wins and every frame carries a CRC.
A standard data frame
ID 0x123 carrying two data bytes. The CRC and the stuff bits are computed for real; watch the extra bit appear after every run of five identical bits.
Whole frame
A 2-byte payload cost 61 bit times on the wire, 1 of them stuff bits. Everything from SOF to the CRC is stuffed; the fixed-form fields at the end are not. At 500 kbit/s that is 122 microseconds.
SOF
Start Of Frame: one dominant (0) bit. The bus idles recessive (1), so this falling edge tells every node a frame begins and lets them align their bit timing.
Identifier 0x123
11-bit identifier, most significant bit first. It does not say who the destination is but what the message is (e.g. engine speed). It is also the priority: when two nodes transmit at once, the lower number wins arbitration because a dominant 0 overwrites a recessive 1 on the wire. 0x123 = 291.
RTR
Remote Transmission Request. 0 = a normal data frame; 1 would ask another node to send this ID.
IDE
Identifier Extension. 0 = standard 11-bit identifier; 1 = extended 29-bit format.
r0 (reserved)
Reserved bit, sent dominant.
DLC = 2
Data Length Code: 2 data bytes follow (0 to 8). Four bits, so values 9–15 also mean 8 in classic CAN.
Stuff bit
Five identical bits in a row (00000), so the transmitter inserts a 1. CAN has no clock wire; the receiver re-synchronises on edges, and forcing an edge every 5 bits guarantees there are enough. Receivers strip stuff bits automatically; they are not part of the data.
Data byte 0 = 0xDE
Payload byte 0, MSB first. A CAN frame carries at most 8 payload bytes; the meaning is defined by whoever designed the signal database for this ID.
Data byte 1 = 0xAD
Payload byte 1, MSB first. A CAN frame carries at most 8 payload bytes; the meaning is defined by whoever designed the signal database for this ID.
Overview
CAN (Controller Area Network) was built for cars: many ECUs share one twisted pair, and any node may speak when the bus is free. Messages are identified by an ID, not an address, and every node sees every frame.
When two nodes start at once, they both watch the wire while sending their ID. A dominant 0 overwrites a recessive 1, so the node sending a 1 sees a 0, realises it lost, and quietly stops. The winner's frame is not damaged at all: arbitration costs no time.
Key facts
- Wires
- CAN_H, CAN_L (differential)
- Clock
- None; edge re-sync + stuffing
- Typical speeds
- 125 k / 500 k / 1 Mbit/s
- Payload
- 0–8 bytes (CAN FD: up to 64)
- Arbitration
- Lowest ID wins (bitwise)
- Error check
- CRC-15 + stuffing + ACK
Where you meet it
- Cars and trucks: engine, brakes, body electronics (OBD-II sits on top of CAN)
- Industrial and agricultural machinery (CANopen, J1939)
- Robots, drones and e-bikes that need a robust multi-node bus
Watch out for
- Both ends of the bus need a 120 Ω terminating resistor. Without it you get reflections and random errors.
- The ID is priority, not a destination: give safety-critical messages low IDs.
- All nodes must agree on the bit rate (and sample point). A node at the wrong speed will flag errors on every frame and can knock the bus off.
Standards
- ISO 11898-1 (CAN data link layer)
- Bosch CAN Specification 2.0