1. Structure of data frame
The basic unit of CANbus communication is data frame. Each data frame consists of the following parts:
Start bit: marks the beginning of the data frame.
Identifier: used to identify the priority and content of the data, the standard frame uses an 11-bit identifier, and the extended frame uses a 29-bit identifier.
Control field: contains the data length code (DLC), indicating the length of the data field.
Data field: the actual data content, up to 8 bytes in standard CAN, and up to 64 bytes in CAN FD.
CRC check: used to detect errors in data transmission.
Response bit: used by the receiving node to confirm the reception of the data frame.
End bit: marks the end of the data frame.
2. Arbitration and priority
When multiple nodes try to send data at the same time, CANbus adopts a priority-based arbitration mechanism:
Priority arbitration: the lower the identifier of the data frame, the higher the priority. During the arbitration process, low-priority data frames will be postponed by high-priority data frames until the bus is idle.
3. Error handling
CANbus has an automatic error detection and recovery mechanism:
Error flag: When an error is detected, the node will issue an error flag and retransmit the data.
Retransmission mechanism: The node will automatically retransmit the data frame until it is successfully received or the maximum number of retransmissions is reached.