The Controller Area Network (CAN) protocol is a widely used communication protocol in the automotive and industrial automation industries. It was originally developed by Robert Bosch GmbH in the 1980s to provide a reliable and efficient means of communication between various electronic control units (ECUs) within a vehicle.
The CAN protocol follows a serial communication method where messages are transmitted over a two-wire bus: the CAN High (CANH) and CAN Low (CANL) lines. This differential signalling scheme helps in reducing noise interference and provides robustness in noisy environments.
DATA FRAME Of CAN
In the Controller Area Network (CAN) protocol, data is transmitted in the form of frames. A CAN frame consists of several components that enable communication between nodes on the network.
Image Taken By CSS
- Start-of-Frame (SOF): The SOF bit marks the beginning of a CAN frame and serves as a synchronization point for all nodes on the network. It is always dominant (0) and helps nodes to align their clocks for accurate data reception.
- Arbitration Field: The arbitration field contains the identifier (ID) of the message. The ID determines the priority of the message and helps in the arbitration process. Messages with lower IDs have higher priority and can preempt messages with higher IDs. The arbitration field is 11 bits long in Standard CAN (CAN 2.0A) and 29 bits long in Extended CAN (CAN 2.0B).
- Control Field: The control field contains various control bits that define the properties of the CAN frame. It includes bits like the Remote Transmission Request (RTR) bit, which indicates whether the frame is a data frame or a remote frame. Data frames carry actual data, while remote frames are used for requesting data from other nodes.
- Data Field: The data field contains the actual payload or data being transmitted. In a data frame, this field can hold up to 8 bytes (64 bits) of data. For remote frames, the data field is unused.
- Cyclic Redundancy Check (CRC): The CRC field is responsible for error detection during transmission. It contains a calculated checksum based on the contents of the frame. The receiving node performs the same calculation and compares the result with the received CRC to check for errors.
- Acknowledgement Field (ACK): The ACK field is used for acknowledging the successful reception of a frame. After transmitting a frame, the sending node expects to receive an ACK bit from the receiving node. If the ACK bit is dominant (0), it means the frame was successfully received. If it is recessive (1), it indicates an error in transmission.
- End-of-Frame (EOF): The EOF bit marks the end of a CAN frame. It is always recessive (1) and provides a bit of time for the bus to return to the idle state before the start of the next frame.
MODE OF CAN
The Controller Area Network (CAN) protocol supports different operating modes that define how nodes on the network transmit and receive messages. These modes determine the behaviour of a node and its interaction with other nodes on the CAN bus.
- Sleep Mode: In Sleep mode, the CAN node enters a low-power state to conserve energy. When in Sleep mode, the node does not actively participate in communication on the bus. It stops transmitting and receiving messages and remains in a low-power state until it receives a wake-up signal or an event triggers it to resume normal operation.
- Listen-Only Mode: In Listen-Only mode, the node can only receive messages but does not transmit any messages on the bus. This mode is useful for monitoring or diagnosing the network without actively participating in the communication. The node can still detect errors, receive ACKs, and perform error checks during reception.
- Normal Mode: Normal mode is the default operating mode of a CAN node. In this mode, the node can both transmit and receive messages on the bus. It actively participates in communication and can send data frames, receive data frames, and respond to remote frames. The node performs the necessary arbitration and error detection mechanisms to ensure reliable and efficient data exchange.
Key Features of CAN
- Robustness and Reliability: CAN is designed to operate reliably in harsh and noisy environments. It uses differential signalling and error detection mechanisms, such as the Cyclic Redundancy Check (CRC), to ensure data integrity. Additionally, CAN implements fault confinement, where a node isolates itself from the network in the event of an error, allowing the rest of the nodes to continue communicating.
- Priority-Based Communication: CAN use a priority-based arbitration mechanism to determine which node can access the bus and transmit a message. Messages with lower priority (determined by the identifier) have higher chances of winning arbitration and gaining bus access. This feature enables deterministic and real-time communication, making it suitable for time-critical applications.
- Multi-Master Capability: CAN supports a multi-master architecture, allowing multiple nodes to transmit and receive messages on the bus. This decentralized structure enables simultaneous and independent communication among different nodes, making it suitable for complex systems with distributed control.
- Scalability: CAN supports various data rates, allowing flexibility in designing CAN networks based on the specific requirements of the application. It offers different variants such as CAN 2.0A (Standard CAN) with lower data rates (up to 1 Mbps) and CAN 2.0B (Extended CAN) with higher data rates (up to 5 Mbps).
- Flexible Network Topologies: CAN support different network topologies, including linear bus, star, and tree structures. This flexibility allows for easy installation and expansion of the network, making it suitable for various applications.
- Error Detection and Diagnostics: CAN provide error detection mechanisms to identify and report errors during transmission. Nodes can detect errors in received messages, such as bit errors or frame corruption, through error flags. This feature simplifies troubleshooting and diagnostics in the network.
- Standardized Higher-Layer Protocols: CAN has standardized higher-layer protocols built on top of the base CAN protocol, such as CANopen and J1939. These protocols define communication profiles and services for specific applications, enabling interoperability and easy integration of CAN-based systems.
Advantage of CAN
- Real-Time Communication: CAN provides deterministic and real-time communication, making it suitable for time-critical applications. The priority-based arbitration mechanism allows for predictable and efficient message transmission, ensuring that critical messages receive timely delivery.
- Scalability: CAN support a wide range of network sizes and topologies. It can be used in small-scale systems with just a few nodes or large-scale networks with numerous interconnected nodes. CAN’s scalability allows for flexible system design and expansion as the application requirements evolve.
- Bandwidth Efficiency: CAN optimize bandwidth utilization by transmitting only relevant data. It employs a message-oriented approach, where each message contains an identifier that determines its priority. This selective transmission of messages minimizes bus congestion and maximizes the efficiency of data transfer.
- Low Cost: CAN offer a cost-effective solution for communication in comparison to other protocols. It requires minimal wiring and uses simple twisted-pair cabling for the bus, reducing material and installation costs. The protocol’s widespread adoption also contributes to the availability of cost-effective CAN-based components and tools.
- Standardization: CAN is an internationally standardized protocol, that ensures compatibility and interoperability between different devices and systems. The availability of standardized higher-layer protocols, such as CANopen and J1939, further enhances interoperability and simplifies integration with existing systems.
Disadvantage of CAN
- Limited Bandwidth: CAN has a limited maximum data rate compared to some other protocols. The standard CAN (CAN 2.0A) supports data rates up to 1 Mbps, while the Extended CAN (CAN 2.0B) can reach up to 5 Mbps. In applications that require high-speed data transfer, such as certain multimedia or high-bandwidth applications, CAN may not be the optimal choice.
- Message Size Limitation: CAN frames have a limited payload size. In standard CAN, the data field can hold up to 8 bytes (64 bits) of data. Although larger messages can be split and transmitted in multiple frames, it adds complexity to the application layer and may impact overall performance.
- Deterministic but Non-Deterministic Delay: While CAN provides deterministic communication by prioritizing messages, it does not guarantee fixed transmission times or delays. The actual transmission time of a message depends on the arbitration process, bus utilization, and the behaviour of other nodes on the network. Consequently, the end-to-end delay of a message in a CAN network can vary.
- Limited Distance: CAN is primarily designed for use in localized networks and may not be suitable for applications requiring long-distance communication. The maximum length of a CAN bus is typically limited to a few hundred meters without additional measures, such as signal repeaters or bridges.
- The complexity of Higher-Layer Protocols: While CAN provides a robust lower-level protocol, the implementation and utilization of higher-layer protocols, such as CANopen or J1939, can be complex. These protocols introduce additional overhead and require specialized knowledge for configuration and customization.
Application of CAN
- Automotive Industry: CAN is extensively used in the automotive sector for in-vehicle communication. It enables communication between various Electronic Control Units (ECUs) in a vehicle, such as an engine control unit, transmission control unit, ABS module, and more. CAN facilitate real-time data exchange, diagnostics, and control functions in automotive systems.
- Industrial Automation: CAN is employed in industrial automation and control systems. It enables communication between different devices, sensors, and actuators in industrial machinery and equipment. CAN is used for tasks such as process control, data acquisition, motor control, and inter-device communication in industrial settings.
- Medical Devices: CAN is utilized in medical devices and equipment for communication between different modules and components. It enables seamless data transfer, control, and monitoring in medical devices such as patient monitors, infusion pumps, imaging equipment, and laboratory instruments.
- Aerospace and Defense: CAN is utilized in aerospace and defence applications for communication between avionics systems and subsystems. It enables reliable data exchange, control, and monitoring in aircraft, satellites, missiles, and other defence systems. CAN provide a robust and efficient communication solution in these critical and high-reliability applications.
One way to cancel CAN communication is to physically disconnect or remove the nodes or devices from the CAN bus. By disconnecting the nodes, you effectively halt the communication on the network.