"Power of CAN Protocol in Automotive"
Published: 2023-11-27 17:09:19

Hello Readers,
My name is Sadashiv Balawad, and I work as a junior software engineer at Luxoft India. I'm  very happy to share this post, in which I relate my previous project in luxoft with CAN Protocol and Power of CAN Protocol in Multi-Master Systems.

**Introduction**
The Controller Area Network (CAN) protocol is a communication protocol that was evolved to be used inside the car enterprise, but has also been utilized in other industries which include commercial automation and medical equipment. It is a serial verbal exchange protocol that makes use of a multi-grasp, allotted manipulate machine. This means that any device on the network, referred to as a node, can provoke verbal exchange and all other nodes on the network can participate within the communique. The protocol presents a way for gadgets to share information and synchronize their actions with out the need for a crucial controller. The protocol uses a collision detection and arbitration approach to prevent multiple nodes from transmitting at the equal time and ensure that simplest one node can transmit at a time.

**Why CAN Protocol in Automotive**
The need for a centralized well known conversation protocol got here because of the boom inside the number of digital devices. For instance, there can be extra than 7 ECU for numerous subsystems together with dashboard, transmission manage, engine manage unit, and lots of extra in a cutting-edge car. If all of the nodes are related one-to-one, then the velocity of the conversation would be very excessive, but the complexity and fee of the wires might be very excessive. In the above example, a unmarried dashboard calls for 8 connectors, so to triumph over this problem, CAN was brought as a centralized solution that requires two wires, i.E., CAN excessive and CAN low. The solution of the use of CAN protocol is pretty efficient because of its message prioritization, and flexible as a node may be inserted or eliminated without affecting the network.

**CAN Framing**
Now will see the structure of CAN Frame

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/slo7z24qh5tmx3dakvoo.png)
SOF: SOF stands for the begin of frame, which suggests that the brand new body is entered in a community. It is of 1 bit.
Identifier: A trendy facts format described beneath the CAN 2.Zero A specification uses an 11-bit message identifier for arbitration. Basically, this message identifier units the concern of the statistics body.
RTR: RTR stands for Remote Transmission Request, which defines the body type, whether it's far a data frame or a far off body. It is of one-bit.
Control field: It has user-described capabilities.
IDE: An IDE bit in a control area stands for identifier extension. A dominant IDE bit defines the 11-bit trendy identifier, while recessive IDE bit defines the 29-bit extended identifier.
DLC: DLC stands for Data Length Code, which defines the records period in a facts discipline. It is of 4 bits.
Data discipline: The statistics discipline can contain upto eight bytes.
CRC subject: The records body also consists of a cyclic redundancy test field of 15 bit, that's used to stumble on the corruption if it takes place all through the transmission time. The sender will compute the CRC before sending the information frame, and the receiver additionally computes the CRC and then compares the computed CRC with the CRC acquired from the sender. If the CRC does now not healthy, then the receiver will generate the mistake.
ACK discipline: This is the receiver's acknowledgment. In different protocols, a separate packet for an acknowledgment is sent after receiving all of the packets, but in case of CAN protocol, no separate packet is despatched for an acknowledgment.
EOF: EOF stands for quit of body. It contains 7 consecutive recessive bits acknowledged End of frame.

**We will now look at how data is transmitted over the CAN network**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c46ytvf6y88f024eb3xm.png)
A CAN network includes multiple of CAN nodes. In the above case, we've got taken into consideration 3 CAN nodes, and named them as node A, node B, and node C. CAN node consists of 3 elements which are given under:

Host
A host is a microcontroller or microprocessor which is walking a few utility to do a selected process. A host makes a decision what the obtained message way and what message it ought to send next.
CAN Controller
CAN controller deals with the communication functions described with the aid of the CAN protocol. It additionally triggers the transmission, or the reception of the CAN messages.
CAN Transceiver
CAN transceiver is answerable for the transmission or the reception of the statistics on the CAN bus. It converts the records signal into the circulation of records accrued from the CAN bus that the CAN controller can recognize.
In the above diagram, unshielded twisted pair cable is used to transmit or receive the records. It is likewise known as CAN bus, and CAN bus includes  lines, i.E., CAN low line and CAN excessive line, which might be also called CANH and CANL, respectively. The transmission takes place because of the differential voltage applied to those strains. For example, in a automobile, motor, ignition system, and many different devices can reason information loss and information corruption because of noise. The twisting of the two traces also reduces the magnetic subject. The bus is terminated with 120Ω resistance at every quit.

Frame types of CAN:
Frame is a described structure or layout that consists of significant information(bytes) within the network. CAN has four body types
            Data Frame
            Remote Frame
            Error Frame
            Overload frame
The more explanation will be continued in next part