The Controller Area Network or CAN Protocol is a method of communication between electronic devices embedded in a vehicle such as engine management systems, active suspension, central locking, air conditioning, airbags, etc. The idea was started by Robert Bosch GmbH in 1983 to improve the quality and safety of automobiles by increasing automobile reliability and fuel efficiency.
Bosch's CAN protocol, first released in 1986, has also provided advances in communication. This was significant because developments in the electronics and semiconductor industries at the time generated new technologies but also challenges for engineers in the automobile industry. For example, electronics offered more functionality and complexity, including the ability to “communicate” between devices. Automotive engineers were often tasked with incorporating these devices, ensuring they worked without errors.
CAN simplified the process, where different electronic modules could communicate with each other using a common cable.
The need for CAN
A vehicle contains a network of electronic devices that share data and information with each other. A spark ignition engine, for example, requires a spark to start the combustion chamber. Timing is important here. To ensure this occurs accurately, it “communicates” with the vehicle's engine control unit, which chooses the optimal moment for ignition to deliver power and fuel efficiency.
Another example of device-to-device communication includes the transmission control unit of an automobile. It automatically changes a vehicle's gear in relation to its speed using data from the engine control unit and various sensors in the system. Every electronic device has an ECU/MCU (electronic/ microcontroller control unit) with its own set of rules for sharing and transferring information.
However, for two or more devices to interact, they must be equipped with hardware and software to communicate properly. Before CAN was used in vehicles, each electronic device was connected to another using wires (or, more specifically, point-to-point wiring). This worked quite effectively when the functions were basic. But one of the main problems for automotive engineers as electronics advanced was connecting the ECUs of different devices so that information could be exchanged in real time. The CAN protocol was designed to solve this problem.

An example of a point-to-point wiring connection in a CAN protocol.
The protocol establishes rules by which electronic devices can exchange information with each other over a common serial bus. Reduced wiring connections and overall system complexity.

An algorithmic diagram showing connectivity between devices using the CAN protocol.
The standard technology at the time – asynchronous transmitter/receiver – was not capable of supporting multi-domain communication. A domain is a group of electronic devices that have similar requirements to function correctly in the system. For example, a CD/DVD player, GPS, and monitors and monitors form a single domain. Likewise, the dashboard, air conditioning (or climate control) system, wipers, lights and door locks form another domain.
T Electronic devices in a vehicle can be classified into different domains, and CAN facilitates cross-domain communication, which is a great help for automotive engineers.

Multi-domain communication from one vehicle, supported by the CAN protocol.
How is the CAN protocol implemented?
The CAN protocol is a set of rules for transmitting and receiving messages over a network of electronic devices. Defines how data is transferred from one device to another over a network.
Interestingly, Podemos was developed with a specific focus on the automobile industry, but its architecture and advantages have led several other industries (such as the railway, aviation and medical sectors) to adopt the protocol as well.

A simplified version of the CAN protocol.
Every electronic device (or node ) that communicates via the CAN protocol is connected to each other via a common serial bus, which allows the transfer of messages. For this data exchange to occur, nodes first require the necessary hardware and software.

Multiple nodes present in a CAN network.
As shown in the figure above, a typical CAN network consists of multiple nodes. Each device has a host controller (ECU/MCU), which is responsible for the function of a specific node, and the CAN Controller and transceiver .
The CAN controller converts messages from nodes according to CAN protocols, which are then transmitted via the CAN transceiver via the serial bus – and vice versa. The controller is a chip built into the node's host controller or added separately.
The CAN protocol does not follow the master-slave architecture, which means that all nodes have access to read and write data on the CAN bus. When the node is ready to send data, it checks bus availability and writes a CAN frame to the network. A frame is a structure that carries a meaningful sequence of bits or bytes of data within the network.
There are two types of protocols: address or message-based.
- In an address-based protocol, data packets contain the address of the device for which the message is intended.
- In a message-based protocol each message is identified by a predefined ID instead of an address.
The CAN transmitted frame is normally a message-based protocol. A message is a data packet that carries information. A CAN message is made up of 10 bytes of data, which are organized in a specific structure (called a frame). The data carried in each byte is defined in the CAN protocol.
All nodes that use the CAN protocol receive a frame and depending on the node ID, CAN “decides” whether to accept it or not. If multiple nodes send the message at the same time, the node with the highest priority (thus the lowest arbitration ID) will receive access to the bus. Lower priority nodes must wait until the bus is available.
Benefits
- Low cost: Because a CAN serial bus uses two wires (with low-cost, high-volume production), it offers a good price-performance ratio.
- Reliable: CAN offers excellent error detection and handling mechanisms, which provide highly reliable transmission. It is also largely immune to electromagnetic interference.
- Flexible: CAN nodes are not limited by protocol and can be easily connected or disconnected.
- Fast: CAN support 1 MBit/s data rate @ 40 m bus length.
- Multimaster communication: Any node can access the bus
- Fault confinement: Faulty nodes do not disrupt communication.
- Broadcast capabilities: Messages can be sent to one/many/all nodes.
- Standardized: ISO has standardized the CAN protocol via ISO-DIS 11898 (for high-speed applications) and ISO-DIS 11519-2 (for low-speed applications). The CAN protocol is also standardized by industry organizations such as the SAE-Society of Automotive Engineers.
CAN architecture
The CAN protocol uses the existing OSI reference model to transfer data between connected nodes in a network. The OSI reference model represents a set of seven layers through which data passes during communication between connected devices. The seven-layer structure of the OSI model is reliable and widely used in various communication protocols.
The CAN architecture.
Each layer has its specific function that supports the layer above and below, as described below.
· Application layer
It serves as a window for users and application processes to access network services. The common functions of the layers are resource sharing, remote file access, network management, electronic messaging, and so on.
· Presentation layer
The most important function of this layer is to define data formats such as ASCII text, EBCDIC BINARY text, BCD and JPEG. It acts as a translator of data into a format used by the application layer at the receiving end of the station.
· Session layer
Allows you to establish, communicate and terminate sessions between processes running on two different devices, performing security, name recognition and registration.
· Transport layer
The transport layer ensures that messages are delivered error-free, in sequence, and without loss or duplication. This relieves the top layer of any concerns about transferring data between themselves and their peers.
· Network layer
It provides end-to-end logical addressing system so that a data packet can be routed through multiple layers and establish, connect and terminate network connections.
· Data Link Layer
It packages raw data into frames transferred from the physical layer. This layer is responsible for transferring frames from one device to another without errors. After sending the frame, it waits for confirmation from the receiving device. The data link layer has two sublayers:
{C 1. MAC (Medium Access Control) Layer: It performs frame encoding, error detection, signaling, serialization and deserialization.
LLC (Logical Link Control) layer: The LLC sublayer provides multiplexing mechanisms that enable different network protocols (IP , Decnet It is Appletalk) coexist in a multipoint network and are transported on the same network medium. It performs the function of multiplexing protocols transmitted by the MAC layer during transmission and decoding when receiving and providing node-to-node flow and error control.
· Physical layer
The physical layer transmits bits from one device to another and regulates the transmission of bit streams. It defines the specific voltage and type of cable to be used for transmission protocols. It provides the hardware means to send and receive data on a carrier by defining cables, cards, and physical aspects.
CAN protocol uses two lower layers of OSI, namely physical layer and data link layer. The remaining five layers, which are communication layers, are left out by the BOSCH CAN specification for system designers to optimize and adapt according to their needs.
Fig. 7: Block diagram showing various layers of a network using CAN protocol
The function of each part is shown in the figure below.
Fig. 8: Block diagram showing functions of various parts of a CAN network
The concept of CAN protocol can be understood using the above figure. Each node has a host controller, also known as a microcontroller, which is a small, low-cost computer. The host controller implements the application layer of the OSI model. The microcontroller collects information from other electronic control units such as brakes, steering, power windows, etc. to communicate with other nodes and transfers them to the CAN controller. The CAN controller incorporates logical link control and data link layer MAC medium access control. LLC allows message filtering by using a unique ID in each message and then the MAC sublayer frames the message. Once framing is done, it is followed by arbitration, error detection, and recognition that everything is in the MAC sublayer of the data link. The frame is transferred to the CAN trans-receiver for encoding and decoding. Finally, the CAN trans-receiver synchronizes with the CAN bus to send the message to another node.
Terms associated with the CAN protocol.
BUS PRICES
Binary values in the CAN protocol are called dominant and recessive bits.
· MAY set logical “0” as the dominant bit.
· MAY set logic “1” as recessive bit.
In the CAN system, the dominant bit always replaces the recessive bit.
Message-based communication
A message is a data packet that carries information to be exchanged between nodes. Each message on CAN has a unique identification number. The identification number is specified according to the message content and stored in the message identifier. This identification number is also unique within the network, so when the transmitting node puts the data into the network for access by all nodes, it checks the unique identification number to allow the message to pass through the filter and the rest to be ignored. This is done to save time spent on sorting. With the message-based protocol, other nodes can be added without reprogramming, since units connected to the bus do not have identifying information such as node addressing. Therefore, there is no need to change the software and hardware of any of the units connected to the bus.
Fig. 9: Diagram showing message-based communication in a CAN protocol using network
Message Framing
Messages in CAN are sent in a format called frames. A frame is a defined structure, carrying significant sequence of bits or bytes of data within the network. Message framing is done by the MAC sublayer of Data Link Layer. There are two types of frames standard or extended. These frames can be differentiated based on identifier fields. A CAN frame with 11-bit identifier fields called standard CAN and with 29-bit identifier field is called an extended frame.
Standard frame
Fig. 10: Figure showing how the message is framed in a standard CAN frame
Various fields in standard CAN are as follows-
{W · SOF – frame start bit. Indicates the beginning of the message and is used to synchronize the nodes on a bus. A dominant bit in the field marks the start of the frame.
· IDENTIFIER – It has a dual purpose: to determine which node has access to the bus and, second, to identify the type of message.
· RTR – Remote Transmission Request. It identifies whether it is a data frame or a remote frame. The RTR is dominant when it is a data frame and recessive when it is a remote frame.
{W}{ · IDE – Identifier extension. It is used to specify the frame format. The dominant tip is for standard molding and recessive for extended molding.
{W} · R0 – Bit inverted. Not currently used and retained for future use.
{W · DLC – Data Length Code. It is a 4-bit data length code that contains the number of bytes being transmitted.
{ · DATA – Used to store up to 64 bits of application data to be transmitted.
{W} · CRC – Cyclic Redundancy Check. The 16-bit cyclic redundancy check (CRC) (15 bits plus delimiter) contains the checksum of previous application data for error detection.
{ · ACKNOWLEDGMENT – Acknowledgment field (ACK). Compromises the ACK slot and ACK delimiter. When data is received correctly, the recessive bit in the ACK slot is replaced as the dominant bit by the receiver.
{W} · End of year – End of frame (EOF). The 7-bit field marks the end of a CAN frame (message) and disables
Bit – filling, indicating filling error when dominant.
{W} · IFS – Inter-Frame Space that specifies the minimum number of bits that separate consecutive messages. gives the interval between two frames and consists of three recessive bits known as interval bits. This time allows nodes to be processed internally before the next frame begins.
EXTENDED CAN
Fig. 11: Parts of the extended CAN network and their functionalities
It is the same as the 11-bit identifier with some fields added
{W · SRR- Reverse replacement request. The SRR bit is always transmitted as a recessive bit to ensure that in the case of arbitration between a Standard Data Frame and an Extended Data Frame, the Standard Data Frame will always take priority if both messages have the same base identifier ( 11 bits). .
{ · R1- It is another bit not currently used and saved for future use.
Message Board
There are four different frames that can be used on the bus.
Data Frames – These are most commonly used frames used when a node transmits information to any or all other nodes in the system. Data Frames consist of fields that provide additional information about the message as defined by the CAN specification. Embedded in the data frames are arbitration fields, control fields, data fields, CRC fields, a 2-bit acknowledgment field, and an end-of-frame.
Fig. 12: Data frames used in a CAN network
· Remote Frames – The purpose of the remote frame is to seek permission to transmit data from another node. This is similar to the data frame with no data field and the RTR bit is recessive. For example, the microprocessor that controls your car's central locking may need to know the state of the transmission gear selector from the powertrain controller.
· Error Frames – If the transmitting or receiving node detects an error, it will immediately abort the transmission and send an error frame consisting of an error flag consisting of six dominant bits and an error flag delimiter consisting of eight recessive bits. The CAN controller ensures that a node cannot block a bus by repeatedly transmitting an error frame.
Fig. 13: Error frames used in a CAN network
· Overload Frame - It is similar to error frame but used to provide extra delay between messages. An overload frame is generated by a node when it becomes too busy and is not ready to receive.
Fig. 14: Overload table present in a CAN network
Arbitration
It is a mechanism that resolves the conflict when two or more nodes try to send the message at the same time . In this technique whenever the bus is free, any unit can transmit a message. If two or more units start transmitting at the same time, bus access conflicts, but this problem can be resolved by arbitration using identifier. During arbitration, each transmitter compares the value of the transmitted bit with the value of the bit on the bus. If the bit value is the same, the node continues to send bits. But at any time, if the transmitted bit value is different from the bus value, the dominant bit overwrites the recessive bits. The CAN message arbitration field consists of an 11- or 29-bit identifier and a remote transmit (RTR) bit. The identifier with the lowest numerical value has the highest priority. The RTR simply distinguishes between the remote frame for which the RTR is recessive and the data frame for which the RTR is dominant. If the data frame and the remote frame with the same identifier are started at the same time, the data frame takes precedence over the remote frame. With the concept of arbitration, no information or time is lost.
CAN as a CSMA protocol
CSMA is a carrier sense multiple access protocol in which the node checks for the absence of traffic before transmitting on a shared medium such as an electrical bus. In CSMA, each node on a bus waits a specific time before sending the message. Once this waiting period is over, all nodes will have equal opportunities to send the message. Based on the pre-programmed priority of each message in the identifier field, that is, the identifier with the highest priority gains access to the bus. It is implemented in the physical layer of the OSI model. Let's understand CSMA with an example. In a discussion, all people have equal opportunities to express their thoughts, however, when one person is speaking, others remain silent and listen and wait for the opportunity to speak (bearer sense). But if two or more people start talking at the same time, they detect the fact and stop talking (collision detection).
Error control
Error checking and fault confinement
This is one of the attributes of CAN that makes it robust. The CAN protocol has five error checking methods, of which three are at the message level while the other two are at the bit level. Each frame is simultaneously accepted or rejected by all nodes in the network. If a node detects an error, it transmits an error flag to each node and destroys the transmitted frame and the transmitting node resends the frame.
Message Level
CRC Check
At this stage, a 15-bit cyclic redundancy check value is calculated by the transmitting node and transmitted in the CRC field. This value is received by all nodes. Then all nodes calculate the CRC value and compare the results with the transmitted value. If the values differ, an error frame will be generated. As one of the nodes did not receive the message correctly, it is resent.
ACK slots
When the sending node sends a message, a recessive bit is sent in the acknowledgment slot. After the message is received, the acknowledgment slot is replaced with the dominant bit that would recognize that at least one node received the message correctly. If this bit is recessive, no node received the message correctly.
Form error
End of frame, space between frames, recognition delimiter are fields that are always recessive, if any node detects a dominant bit in one of these fields the CAN protocol calls it a violation and a form frame is generated and the original message is resent after certain period.
Bit Level
Material error
Bit stuffing – It is a very common technique used in telecommunications and data transmission to insert uninformative bits to have the same bit rates or to fill frames. These extra bits are removed by the data link layer to recover the original message. This same technique is used in bit error. The CAN bus is never idle because it uses the NRZ method. After five consecutive bits of the same value, a bit with the opposite complement or value is inserted into the bit stream. If six bits of the same value are detected between the SOF and CRC delimiter, the error frame will be generated. After errors are detected, transmission is aborted and the frame is repeated. If errors persist, the station or node may shut down to prevent the bus from becoming stuck.
bit error
A node sending the bit always monitors the bus. If the bit sent by the transmitter is different from the bit value on the bus, an error frame will be generated. But there is an exception in the case of arbitration field or recognition slot where a recessive bit is sent and a dominant bit is received. So no bit errors occur when the dominant bit is monitored.
Conclusion
CAN protocol initially developed for automotive networks in vehicles, has expanded its applications in several other sectors. The application started for luxury cars is now being used in heavy vehicles like trucks, buses, trains and railway vehicles. The unique feature of CAN that allows multiple electronic units to communicate with each other has made it important in the healthcare domain. For example, intensive care units and operating rooms where time and communication are of utmost importance. The entertainment industry has also used CAN protocols to improve the capabilities of studios to control lights and door systems and to control theater stages, event halls, etc. Gambling machines and toys are other examples in the entertainment field. In the field of science, high-energy experiments and astronomical telescopes use CAN in embedded networks.