CAN Message Frames
About CAN Message:
The main purpose of the whole CAN network is to establish proper and secure communication between various ECUs used in the vehicle.
All the required ECUs exchange data and instructions with each other through the network by sending and receiving messages. CAN
messages
are also known as Frames or "CAN Frames ".
Now the next important thing to remember is that a CAN network can be configured to work with two different types of messages
or frame formats.
These are:-
- Standard CAN frame format
- Extended CAN frame format
The main difference between the two formats is that the Standard CAN frame format supports the length of 11 bits for the identifier.
On the other hand, the " Extended CAN frame " format supports the length of 29 bits for the identifier. Here in this case, 11 bits
are " base
identifiers " and the remaining 18 bits are " identifier extensions ".
Let's see about CAN Frames and identifiers in details.
CAN Message Format:
CAN Message format can be explained in a better way from the below diagram:-
Above mentioned CAN Message format can be summarized as below:
Field Name | Length(in bits) | Purpose |
---|---|---|
Start-Of_Frame | 1 | Represent the start of the frame transmission |
Identifier | 11 | A unique identifer which represent the message priority |
Remote Transmission Request (RTR) | 1 | Dominant(0) for data frame and Recessive(1) for remote request frame |
Identifier Extension bit (IDE) | 1 | Dominant(0) for the base frame fromat with 11 bit identifier |
Reserved bit | 1 | It must be Dominant(0), but accepted as either Dominant(0) or Recessive(1) |
Data Length Code (DLC) | 4 | Length of data or number of bytes of data to be transmitted |
Data Field | 0-64 | Exact data to be transmitted |
Cyclic Redundency Check (CRC) | 15 | CRC check of the data |
CRC Delimiter | 1 | It should be Recessive(1) |
Acknowledgement bit (ACK) | 1 | Transmitter send Recessive(1) and Receiver can assert a Dominant(0) |
ACK Delimiter | 1 | It should be Recessive(1) |
End-Of-Frame (EOF) | 7 | It should be Recessive(1) |
Detailed desctiption of each fields:
Now lets see each fields in detail:
-
Start-Of_Frame:
It indicate the start of data frame and remote frame.
It is indicated by the falling edge of the bus signal. Reception continues when the Dominant bit is detected and bus become idle
when the Recessive bit is detected.
-
Arbitration Field:
This field will sets the priority, specifies the data frame or remote frame and defines the protocol mode.
The identifier is transmitted with the MSB(Most Signifcant Bit) at the first position.
Bits r0 and r1 are reserved for future use.
-
Control Field:
Detailed view of the control field is as below:
The value of the DLC in the data field specifies the number of data bytes in the current frame.
The SRR(Substitute Remote Request) in only used in the Extended CAN format it is always Recessive.
-
Data Field:
This field carries the data bytes that needs to be transmitted.
The number or length of data bytes is defined by the DLC value of the Control field
-
CRC Field:
Detailed view of the CRC field is as below:
This field consists of 15 bit CRC(Cyclic Redundancy Check) sequence to check transmission error and a CRC delimiter.
The transmitting node will transmit the CRC sequence calculated from start of frame, arbitration field, control field, and data field.
On the receiver side, the received CRC will be compared with the CRC which is calculated by the receiver node. In case of a mismatch
of the two CRCs the receiver, node will generate the error frame.
Also while calculating the CRC in both the transmitter and receiver side the stuff bits will be eliminated.
-
ACK Field:
This field is used by the Receiver node to inform the transmitter in case of normal reception.
Receive node sets the ACK slot in the ACK field to dominant bit when no error was detected.
-
End Of Frame:
This field indicates the end of the CAN frame transmission.
Different types of CAN frames:
There are basically four types of CAN frames or CAN messages. These are:
- Data Frame
- Remote Frame
- Error Frame
- Overload Frame
Data frame:
The data frame is one of the important frames as it carries the data from the transmitter node to other receiver nodes or a single node.
It uses
two types of frame format, Standard format (of 11 bits) and Extended fromat (of 29 bits).
Remote Frame:
In the real-time scenario, the data transmission is performed on an autonomous basis when the source node like sensors, sends the
data
continuously at a regular intervals of time. But there is also the possibility that the destination node requests the data from
the source node.
And in order to do so the destination node sends Remote Frame to the source node. Like the Data frame, it is also
of two types, Standard and
Extended.
It is similar to Data Frame with one difference that in Remote Frame there is no Data Field and the RTR bit is Recessive.
Error Frame:
It is the frame sent by any of the nodes which signify the bus errors have been detected during transmission.
The category of the Error Frame is defined by its error flag that is ACTIVE ERROR FLAG or PASSIVE ERROR FLAG. The type of flag that a
node transmitts depends on the internal count of the error counters of each node.
We will look about different types of error in detail in the upcoming chapter.
Overload Frame:
It is the frame that is intentionally added to introduce the delay between the data frame and the remote frame. Some important points
related to Overload Frame are:-
- When a bit error is detected in transmission, then an overload frame is sent following the next bit after the error bit
- At most two Overload Frame is generated to delay the next Data Frame or Remote Frame