- Controller Area Network or CAN protocol is a method of communication between various electronic devices like engine management systems, active suspension, ABS, gear control, lighting control, air conditioning, airbags, central locking etc embedded in an automobile.
- CAN protocol can be defined as the set of rules for transmitting and receiving messages in a network of electronic devices.
- It means that it defines how data is transferred from one device to another in a network. It was designed specifically looking into the needs of the automobile industry.
- However CAN's robust architecture and advantages has forced many industries like Railway, Aircrafts, medical etc to adopt CAN protocol in their systems.
- As shown in the above figure a typical CAN network consists of various nodes.
- Every node has a Host controller (ECU/MCU) which is responsible for the functioning of the respective node.
- In addition to the host controller every node has a CAN controller and CAN transceiver.
- CAN controller convert the messages of the nodes in accordance with the CAN protocols to be transmitted via CAN transceiver over the serial bus and vice versa.
- CAN controller is a chip which can either be added separately or embedded inside the host controller of the node.
- CAN does not follow the master-slave architecture which means every nodes has the access to read and write data on the CAN bus.
- When the node is ready to send data, it checks availability of the bus and writes a CAN frame onto the network.
- A frame is defined structure, carrying meaningful sequence of bit or bytes of data within the network.
- CAN transmitted frame does have address neither of transmitting node or the receiving node.
- CAN is a message based protocol. A message can be defined as a packet of data which carries information.
- A CAN message is made up of 10 bytes of data. The data is organized in a specific structure called frame and the information carried in every byte is defined in the CAN protocol
Various fields in standard CAN are as follows-
SOF - Start of Frame bit. It indicates start of message and used to synchronize the nodes on a bus. A dominant bit in the field marks the start of frame.
IDENTIFIER - It serves dual purpose one, 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’s a data frame or a remote frame .RTR is dominant when it is a data frame and recessive when it is a remote frame.
IDE – Identifier Extension. It is used to specify the frame format. Dominant bit is for standard frame and recessive for extended frame.
R0 - Reversed bit. Not used currently and kept for future use.
DLC – Data Length Code. It is 4 bit data length code that contains the number of bytes being transmitted.
DATA– Used to store up to 64 data bits of application data to be transmitted.
CRC– Cyclic Redundancy Check. The 16-bit (15 bits plus delimiter) cyclic redundancy check (CRC) contains the checksum of the preceding application data for error detection.
ACK – Acknowledge (ACK) field. It compromises of the ACK slot and the ACK delimiter. When the data is received correctly the recessive bit in ACK slot is overwritten as dominant bit by the receiver.
EOF– End of Frame (EOF). The 7-bit field marks the end of a CAN frame (message) and disables
Bit - stuffing, indicating a stuffing error when dominant.
IFS - Inter Frame Space that specifies minimum number of bits separating consecutive messages. It provides the intermission between two frames and consists of three recessive bits known as intermission bits. This time allows nodes for internal processing before the start of next frame.
It is same as 11-bit identifier with some added fields
SRR- Substitute Reverse 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 have priority if both messages have the same base (11 bit) identifier.
R1- It is another bit not used currently and kept for future use.