What is CAN? Reliable communication for cars and industrial robots
Atlasbot · 16/8/2026 · 11 min read
In a modern car there are dozens of electronic control units (ECUs) that share information — wheel speed, motor temperature, brake status — all of which must be transmitted extremely reliably despite a large electrical noise environment. CAN (Controller Area Network) was designed primarily for this problem, and for the same reason it is popular in industrial motor drivers and large AMR robots.
Key concepts
Like RS485, CAN uses 2-wire differential signals (CAN_H, CAN_L) to prevent interference well. But the fundamental difference lies in the communication model: CAN is not a "node A sends to node B" type like UART — each message is assigned a ID describing the type of data it contains (e.g. "left motor speed"), and every node on the bus receives, deciding whether to pay attention to that ID or not.
Lossless arbitration — CAN's greatest strength
When multiple nodes want to send at the same time, CAN has a bit-based arbitration mechanism: each bit on the bus can be "dominant" (value 0) or "recessive" (value 1) — if a node sends a recessive bit but reads back that the bus is dominant (sent by another node), it immediately understands that it is losing to the referee and automatically stops, yielding the bus. for nodes with higher priority IDs (the smaller the ID, the higher the priority) — no node needs to wait/retry from the beginning, no messages are lost, different from the "collision and retry" mechanism of many other networks.
In short: CAN sends by ID (data type) not by node address, and has an arbitration mechanism that ensures the most important messages are always transmitted first without being lost — this is why CAN is chosen for systems that require high reliability such as cars, airplanes, and industrial robots.
How it works
Node A sends ID = 0x100 (high priority) ─┐
Node B sends ID = 0x200 (low priority) ─┤── at the same time on the bus
│
Node B detects losing to referee ────┘── backs itself
Node A continues to send the complete message, without losing data
Node B automatically resends its message immediately afterwards
Example of sending a CAN message using HAL on STM32:
CAN_TxHeaderTypeDef header;
header.StdId = 0x100; // Message ID — also determines priority
header.DLC = 8; // Number of data bytes (maximum 8 bytes/message)
uint8_t data[8] = {0}; // Actual data, for example motor speed
uint32_t mailbox;
HAL_CAN_AddTxMessage(&hcan1, &header, data, &mailbox);
Technical details
Formulas
Bitrate directly determines the maximum bus distance tolerable (same principle as in RS485) — the signal needs enough time to propagate and stabilize before the node checks the referee:
1 bit time = 1 / bitrate
VD: bitrate = 500 kbps
1 bit time = 1 / 500,000 = 2µs
→ short enough to detect arbitration collisions almost instantaneously within 1 bit cycle
Parameters
Standard CAN bitrate and corresponding maximum bus distance — same speed/distance trade-off as RS485:
| Bitrate | Maximum bus distance |
|---|---|
| 1 Mbps | ~40m |
| 500 kbps | ~100m |
| 125 kbps | ~500m |
CAN has 2 ID formats: CAN 2.0A (standard 11-bit ID, maximum 2048 IDs) and CAN 2.0B (29-bit extended ID, over 500 million IDs) — most industrial/robotic applications use CAN 2.0A because 2048 IDs are available surplus.
Register / Bit / Byte
The DLC (Data Length Code) field in each CAN frame is a 4-bit, encoding the actual number of data bytes in the message — from 0000 (0 bytes, event indicator message without data) to 1000 (8 bytes, maximum for classic CAN). The receiving node reads these 4 bits correctly to know how many bytes to read next in the data field, avoiding reading excess/missing bytes compared to the actual message sent.
Protocol
CAN itself only defines the physical layer and message framing — high-layer protocols built on top of CAN include CANopen (popular in industrial automation/robotics, standardizes how to assign meaning to IDs and data) and J1939 (used in trucks/heavy construction vehicles) — choosing the right upper-layer protocol helps devices Devices from many different companies "understand" the correct meaning of each other's data, instead of each company defining its own ID.
Practical applications
In a multi-motor AMR architecture, CAN is usually the bus that connects the central controller with multiple motor drivers (one driver per wheel) — the arbitration mechanism ensures that the most important message (eg ID 0x001 reserved for emergency stop command) always wins the referee and is transmitted first, even if the bus is busy transmitting telemetry data periodically (eg: ID 0x200 reporting motor speed) — this is why CAN is preferred over RS485/Modbus RTU for systems with strict safety requirements where an emergency stop command must never be delayed because the bus is busy.
Practical example
Scenario: the bus is busy, suddenly there is an emergency stop order
Time t: Node telemetry is sending ID 0x200 (motor speed report)
Time t: Secure node needs to send ID 0x001 (emergency stop command) — Smaller ID = higher priority
Referee results:
Node telemetry (ID 0x200) detects referee loss from different starting bit → automatically backs off
The secure node (ID 0x001) continues to send the entire emergency stop message, without any delay
Node telemetry automatically resends its message immediately afterwards
This result illustrates exactly why CAN is chosen for a secure system — the latency of high priority messages does not depend on whether the bus is busy with lower priority messages or not, unlike buses without an arbitration mechanism (which easily get "stuck" waiting for their turn).
Common mistakes
- Node enters "Bus-Off" state — CAN controller automatically counts transmission errors; If a node continuously encounters errors (e.g. due to broken wires, wrong bitrate), it completely disconnects itself from the bus to avoid damaging the communication of other nodes — need to monitor the error status register to detect and handle before the node is completely "silent".
- Lack of 120Ω termination resistor — like RS485, long CAN cables require termination resistors at the two furthest ends of the bus to avoid signal reflection.
- Duplicate ID for 2 different types of data — each ID should represent exactly 1 specific type of information; Using the same ID for two different purposes makes the receiving node unable to distinguish what data it is receiving.
- Incorrect bitrate between nodes on the same bus — all nodes on a CAN bus must have the same bitrate (unlike UART, which only affects both sides) — 1 node with incorrect bitrate configuration can cause errors for the entire bus, not just that node.
Conclusion
CAN delivers superior reliability thanks to ID-based arbitration at the hardware layer — important messages are always prioritized without losing data, at the expense of each message containing a maximum of 8 bytes. This is the top choice for robot/AMR systems that need to ensure strict safety. The next article in this section is about Modbus RTU — the most popular application layer protocol running on the RS485 platform, often found when integrating with PLCs and industrial equipment.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.