CAN (Controller Area Network) communication protocol is a robust vehicle bus standard designed to allow microcontrollers and devices to communicate with each other without a host computer. It is a message-based protocol, designed originally for multiplex electrical wiring within automobiles, but is also used in many other embedded systems.
CAN protocol was developed by Robert Bosch GmbH in the 1980s for automotive applications. The primary goals were to reduce wiring complexity, increase reliability, and enable real-time communication between various electronic control units (ECUs) in vehicles.
Key features of CAN include:
- Multi-master bus arbitration
- Built-in error detection and confinement
- Prioritized message transmission
- Robustness in noisy environments
- Classical CAN supports up to 1 Mbps, while CAN FD enables higher data rates (typically up to 8 Mbps) during the data phase.
The CAN bus uses a two-wire differential signaling scheme:
- CAN_H (CAN High)
- CAN_L (CAN Low)
In dominant state: CAN_H ≈ 3.5V, CAN_L ≈ 1.5V
In recessive state: Both lines at approximately 2.5V (no differential voltage)
The differential nature makes CAN highly resistant to electromagnetic interference (EMI), which is crucial in automotive and industrial environments.
CAN networks typically use 120Ω termination resistors at both ends of the bus to prevent signal reflections.
CAN uses either Standard (11-bit identifier) or Extended (29-bit identifier) frame formats. Each frame consists of:
- Start of Frame (SOF) - 1 dominant bit
- Arbitration Field - 11-bit (standard) or 29-bit (extended) identifier + RTR bit
- Control Field - Contains IDE (Identifier Extension) (1 bit), reserved bit(s), DLC (Data Length Code) (4 bits)
- Data Field - 0-8 bytes (Classical CAN) or up to 64 bytes (CAN FD)
- CRC Field - Classical CAN uses a 15-bit CRC, while CAN FD uses 17- or 21-bit CRC depending on the payload size + CRC delimiter
- ACK Field - ACK slot + ACK delimiter
- End of Frame (EOF) - 7 recessive bits
- InterFrame Space (IFS) - 3 recessive bits
CAN implements sophisticated error detection mechanisms:
- Bit Monitoring
- Bit Stuffing
- CRC Check
- Form Check
- Acknowledgment Check
When errors are detected, nodes maintain transmit and receive error counters and can transition from Error Active to Error Passive, and eventually to Bus-Off state.
CAN is widely used in:
- Automotive: Engine control, transmission, braking systems, body electronics
- Industrial: Factory automation, robotics, process control
- Medical: Medical devices and equipment
- Aerospace: Avionics and spacecraft systems
- Maritime: Ship navigation and control systems
Several CAN variants have been developed to meet evolving needs:
- Classical CAN (ISO 11898-1): Original specification
- CAN FD (Flexible Data-rate): Higher data rates and larger payloads
- CAN XL: Even higher bandwidth for future applications
- CANopen: Higher-layer protocol for industrial automation
- DeviceNet: Industrial network protocol based on CAN
CAN protocol remains a cornerstone of embedded communication systems due to its reliability, real-time capabilities, and robustness in harsh environments. Understanding CAN is essential for embedded engineers working in automotive, industrial, and many other sectors where reliable communication between microcontrollers is critical.
Frequently Asked Questions
How does CAN bus handle collisions without losing data?
CAN uses CSMA/CR (Carrier Sense Multiple Access with Collision Resolution) based on message IDs. Lower numerical IDs represent higher priority. Nodes transmit simultaneously, and the one with the lowest ID wins arbitration without corrupting the message.
Why does the CAN protocol use differential signaling?
Differential signaling compares the voltage difference between two lines (CAN High and CAN Low). This makes it highly resistant to common-mode electromagnetic noise, which is critical in automotive and industrial environments.
What is the purpose of termination resistors on a CAN bus?
A 120-ohm resistor is required at each physical end of the bus. They match the characteristic impedance of the twisted-pair cable, preventing signal reflections that can corrupt communication.