The Controller Area Network (CAN) Bus is arguably the most widely used communication protocol in the automotive today. It was originally developed by Robert Bosch GmbH in the 1980s to facilitate communication between various electronic control units (ECUs) in vehicles. Since then, it has become the de facto standard for in-vehicle communication, enabling seamless interaction between different systems and components. It also found wide adoption in industrial automation, aerospace, rail, and electric charger industries.
The CAN Bus is a message-based protocol, meaning that data is transmitted in the form of messages. CAN 2.0 released by Bosch, is later adopted by ISO as ISO898-1 for data link and ISO898-2 for physical layer. In this article, we will cover the basics of the CAN communication and see how it maps to the standard OSI layer model.
Controller Area Network Bus Architecture
To fully grasp how the Controller Area Network - CAN Bus works, it is important to understand its architecture.
The CAN Bus architecture is based on a multi-master multi-drop system, where multiple nodes can transmit and receive messages simultaneously allowing for efficient and real-time communication between different components in the network. A message transmitted by a node is received by all the nodes in the network, including the transmitting node. This gives the ability for collision-detection and the transmitting node can always stop when it detects simultaneous attempt to transfer by another node.
- Mapping the CAN Bus to the OSI Layer Model - The CAN Bus can be mapped to the OSI Layer Model, which is a conceptual framework that describes the functions of a communication system. This mapping will help us understand the different layers of the CAN Bus and how they interact with each other.
As can be seen, the Controller Area Network protocol specifies both the physical and data link layer of the OSI standard ensuring error free and reliable communication of the data. Beyond this, it is the scope of the application to define the higher-level protocols. Typically, the CAN protocols like UDS, DeviceNet etc. define these layers.
CAN Physical Layer
The first layer of the CAN Bus, defined in ISO11898-2, is the Physical Layer. The CAN bus consists of two wires: CAN High (CANH) and CAN Low (CANL). These wires (Physical Media) are responsible for carrying the electrical signals that represent the messages being transmitted. This Physical layer is responsible for transmitting and receiving electrical signals over the bus wires. It defines the voltage levels, baud rate, and other physical characteristics of communication. It also specifies the 120 Ohms termination resistors to be present on the edges of the bus.
The CAN Physical Layer is in turn divided into Physical Medium Attachment and Medium Dependent Interface. The Physical Medium Attachment (PMA) defines electrical characteristics at the hardware level. Implemented via the CAN transceivers, typically two standards are defined – high-speed CAN and low-speed fault-tolerant CAN. The Physical Media Dependent (PMD) defines the connectors and wires to be used, though no standards are specified but rather left to the application. One common interface is the DB9.
In CAN Physical Layer, a differential signaling scheme is used, where the CANH wire carries a positive voltage and the CANL wire carries a negative voltage. The voltage difference between the two wires represents the data being transmitted. A ‘1’ in the bus is called Dominant and ‘0’ is called Recessive. The typical waveforms corresponding to these states with respect to both high and low speed CAN are as below.
Controller Area Network standard specifies support for different data rates such as 125kbps for low-speed CAN, 1 Mbps for high-speed, 2,5 and 10 Mbps for CAN FD, CAN FD SIC and CAN SIC XL respectively. Cable length up to 500 m is supported.
CAN Data Link Layer
Above the CAN Physical Layer is the CAN Data Link Layer. This layer is responsible for error detection and correction, as well as framing and synchronization of the data. It ensures that the messages sent over the bus are received correctly and in the proper order. The CAN Data Link Layer (DLL) is sub divided into Logical Link Control, Media Access control and Physical Coding. The Physical Coding Sub-layer defines the bit timing and associated phases. MAC manages the physical layer communication while the LLC manages the communication from higher layers.
One of the key features of the Data Link Layer is the use of a cyclic redundancy check (CRC) algorithm. This algorithm calculates a unique checksum for each message, which is then used to detect any errors during transmission. If an error is detected, the receiving node can request retransmission of the message.
In addition to error detection, the CAN Data Link Layer also handles message framing. Each message on the CAN Bus is divided into different fields, such as the identifier field, data field, and CRC field. These fields help to ensure that the messages are properly structured and can be easily interpreted by the receiving nodes.
Bit Timing in CAN Bus
Bit timing is a critical aspect of the CAN Bus, as it determines the speed at which data is transmitted and received. It is defined by the baud rate, which represents the number of bits transmitted per second. Each bit of a CAN frame is divided into small unis of time called quanta, typically between 8 to 14 based on the implementation. The bit is also segmented in to 4 parts called Synchronization, Propagation and Phase 1 and Phase 2. Duration of each of these segments are defined during initialization stage in counts of quanta.
The bit timing parameters, such as the propagation delay and synchronization jump width, are carefully chosen to ensure reliable communication and minimize the chances of collisions. The CAN receiver synchronies for every recessive to dominant transition thereby ensuring the nodes are in sync even without a dedicated clock signal. These parameters depend on the CAN bus as well as determines the quality of the CAN data transfer.
The CAN Bus uses a bit-wise arbitration mechanism to determine which node has the right to transmit data. Each node compares the transmitted and received bits and determines if they match. If there is a mismatch, the node with the lower identifier continues transmitting, while the node with the higher identifier backs off.
Advantages and Applications of CAN Bus
The Controller Area Network Bus offers several advantages over other communication protocols, which has contributed to its widespread adoption in the automotive industry. One of the key advantages is its high reliability and fault tolerance. The multi-master architecture of the CAN Bus ensures that even if one node fails, communication can continue.
Another advantage of the CAN Bus is its real-time capability. The messages on the bus are transmitted and received in a deterministic manner, allowing for precise timing and synchronization. This is crucial for applications that require quick response times, such as engine control and anti-lock braking systems.
The CAN Bus is widely used in various automotive applications, including engine control, transmission control, chassis control, and body control. It enables different systems and components to work together seamlessly, resulting in improved performance, safety, and efficiency.
Challenges and Limitations of CAN Bus
Despite its numerous advantages, the CAN Bus also has some limitations and challenges. One of the main limitations is its limited bandwidth. The CAN Bus was designed for low to medium data rates, and it may not be suitable for applications that require high-speed data transfer, such as video streaming or high-resolution graphics.
Another challenge is the lack of built-in security features on the CAN Bus. As the automotive industry becomes more connected, the risk of cyber-attacks and unauthorized access to the CAN Bus increases. To address this, additional security measures, such as encryption and authentication, need to be implemented.
Furthermore, the Controller Area Network Bus is a shared bus, which means that all nodes on the bus have equal access to the communication medium. This can lead to bus saturation and increased latency, especially in scenarios where many nodes are connected.
Conclusion
In conclusion, the Controller Area Network (CAN) Bus is a vital communication protocol in the automotive industry. It facilitates seamless interaction between different systems and components, ensuring optimal performance, safety, and efficiency.
By understanding the inner workings of the CAN Bus, including its architecture, mapping to the OSI Layer Model, and the different layers involved, we can gain a deeper appreciation for its functionality and capabilities. In the upcoming article, we will cover the frame format in the CAN bus.