Vehicle Communication and Networking · Vehicle bus
CAN Frame
Also known as CAN message, data frame, remote frame, error frame, CBFF, CEFF, FBFF, FEFF, XLFF
The unit of transmission on a CAN bus: a bit sequence with start of frame, arbitration field (identifier), control field with data length code, data field, CRC, acknowledgement slot and end of frame.
Explanation
Classical CAN defines data frames, remote frames (which request data) and error frames. A data frame begins with a dominant start-of-frame bit that synchronises all nodes. Next comes the arbitration field (the identifier and RTR bit), then a control field (the IDE bit and the data length code), 0 to 8 data bytes, and a 15-bit CRC. Receivers then drive a dominant bit in the acknowledgement slot, an end-of-frame field closes the frame, and at least three intermission bits separate consecutive frames.
After five consecutive bits of the same value, the transmitter inserts a complementary stuff bit so receivers stay synchronised. Stuff bits lengthen frames depending on their content. CAN FD frames (base FBFF and extended FEFF formats) add FDF, BRS and ESI bits, carry up to 64 bytes and use 17-bit or 21-bit CRCs with a stuff-bit counter. CAN XL frames (XLFF) carry 1 to 2048 bytes and add SDT, VCID and acceptance fields.
In software, frames are usually handled as structures, such as Linux's struct can_frame with a 32-bit can_id, a length and an 8-byte data array, rather than as raw bits. Bus timing calculations must still use the bit-level length, including stuffing.
How it works
The transmitter serialises the frame bit by bit, applying bit stuffing. Every node samples each bit at its configured sample point and resynchronises on signal edges. Receivers recompute the CRC and check the fixed-format fields, and if everything is correct they assert the acknowledgement slot. Any node that detects an error sends an error frame, the frame is discarded across the network and the transmitter retries.
Automotive applications
- Decoding bus traces in analysers
- Calculating bus load and worst-case latency
- Mapping signals into payload bytes
- Implementing drivers and protocol stacks
Example
A Classical CAN data frame with an 11-bit identifier and 8 data bytes is 108 bits long before stuffing, plus 3 intermission bits. At 500 kbit/s that is about 0.22 ms of bus time, a figure used when estimating bus load and latency.
An illustrative example: any figures in it are worked numbers, not measurements.
References
- CAN CC (Classical CAN) (opens in a new tab)
- CAN FD: The basic idea (opens in a new tab)
- SocketCAN - Controller Area Network (opens in a new tab)
Definitions are original summaries. Standards text is not reproduced; follow the links for the official publications.