Controller Area Network (CAN) Protocol: Robust Communication for Embedded Systems
Explore the Controller Area Network (CAN) protocol, its architecture, message-based communication, and priority-based arbitration. This guide details CAN's use in automotive systems and other applications requiring reliable and efficient embedded communication.
Controller Area Network (CAN) Protocol: A Robust Communication System
What is the CAN Protocol?
The Controller Area Network (CAN) protocol is a robust, message-based communication system designed for embedded systems. It allows microcontrollers and other devices to communicate with each other without needing a central computer. CAN uses a shared bus—all nodes can see all messages—but a priority system ensures efficient data transmission even when multiple devices want to send data simultaneously.
Why Was CAN Developed?
CAN was initially developed for automotive applications to handle the increasing number of electronic control units (ECUs) in vehicles. The use of a single, shared bus greatly simplified wiring, reducing cost and complexity compared to using many individual wires for point-to-point connections between every device.
Applications of CAN
While initially used in cars, CAN's reliability and efficiency have made it popular in many other applications:
- Automotive (cars, trucks, buses)
- Industrial automation
- Robotics
- Medical devices
- Aerospace
- Building automation
CAN Protocol Architecture
CAN has a two-layer architecture:
- Data Link Layer: Manages communication between nodes, including error detection and framing.
- Physical Layer: Defines the physical characteristics of the network (wiring, voltage levels, etc.).
CAN Specifications (ISO 11898)
The CAN protocol is standardized by the ISO 11898 standard:
- ISO 11898-1: Data link and physical layers.
- ISO 11898-2: High-speed CAN (up to 1 Mbps).
- ISO 11898-3: Low-speed CAN (up to 125 kbps).
CAN Frame Structure
A CAN message frame consists of these fields:
- SOF (Start of Frame): Marks the beginning of a message.
- Identifier: A unique identifier that determines message priority (lower value = higher priority).
- Control Field: Information about the message type (data or remote request).
- Data Field: Up to 8 bytes of data.
- CRC (Cyclic Redundancy Check): Error detection code.
- ACK (Acknowledgment): Confirms message receipt.
- EOF (End of Frame): Marks the end of the message.
CAN Communication: Message Transmission and Arbitration
Nodes transmit messages onto a shared twisted-pair bus (CAN High and CAN Low). A priority-based arbitration mechanism ensures that higher-priority messages are transmitted first. If two nodes try to transmit simultaneously, the higher-priority message wins, and the lower-priority node stops transmitting.
Signal States:
- Recessive State (Logic 1): Both CAN High and CAN Low at 2.5V.
- Dominant State (Logic 0): CAN High at 3.5V, CAN Low at 1.5V.
The dominant state overrides the recessive state, giving priority messages precedence.
Conclusion
CAN's efficient and robust design, combined with its inherent error detection and flexible architecture, makes it well-suited for applications demanding reliability and speed. Its ability to operate without a central host computer increases its versatility and resilience.