Controller Area Network (CAN) is a robust, multi master serial communication protocol originally developed by Bosch in 1986 that has become the backbone of automotive embedded systems, connecting Electronic Control Units (ECUs) for engine management, transmission, braking, airbags, and infotainment. CAN uses a message based protocol with nondestructive bitwise arbitration, meaning multiple nodes can attempt to transmit simultaneously and the highest priority message (lowest ID) wins without data loss. Classic CAN supports data rates up to 1 Mbps with 8 byte payloads, while CAN FD (Flexible Data rate), introduced in 2012, increases the payload to 64 bytes and the data phase bit rate to 5 to 8 Mbps. A modern vehicle contains 70 to 150 ECUs communicating over multiple CAN buses segmented by domain (powertrain, chassis, body, infotainment). The protocol's built in error detection mechanisms including CRC, bit stuffing, frame checks, and automatic retransmission provide the reliability required for safety critical automotive applications conforming to ISO 11898 and AUTOSAR standards.
How Does CAN Bus Message Arbitration Work?
CAN uses Carrier Sense Multiple Access with Collision Detection and Arbitration on Message Priority (CSMA/CD+AMP). When a node wants to transmit, it waits for bus idle, then starts sending the message identifier bit by bit. The bus uses wired AND logic: a dominant bit (0) overrides a recessive bit (1). If a node transmits a recessive bit but reads a dominant bit on the bus, it knows another node with a higher priority message is transmitting and immediately backs off. This nondestructive arbitration means the highest priority message always gets through without delay, while lower priority messages are deferred. The 11 bit standard identifier (CAN 2.0A) allows 2,048 unique message IDs, while the 29 bit extended identifier (CAN 2.0B) supports over 500 million unique IDs.
What Is a CAN Frame Structure?
/* CAN Frame Structure (Standard 11-bit ID)
* ┌─────┬──────────┬───┬────┬──────────┬─────┬─────┬─────┬───────┐
* │ SOF │ Arb Field│RTR│ IDE│ DLC (4b) │Data │ CRC │ ACK │ EOF │
* │ 1b │ 11-bit │1b │ 1b │ 4 bits │0-8B │ 15b │ 2b │ 7b │
* └─────┴──────────┴───┴────┴──────────┴─────┴─────┴─────┴───────┘
*/
// STM32 CAN Transmission Example (using HAL)
CAN_TxHeaderTypeDef txHeader;
uint8_t txData[8] = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08};
uint32_t txMailbox;
txHeader.StdId = 0x321; // 11-bit identifier
txHeader.ExtId = 0;
txHeader.RTR = CAN_RTR_DATA; // Data frame
txHeader.IDE = CAN_ID_STD; // Standard ID
txHeader.DLC = 8; // 8 bytes payload
txHeader.TransmitGlobalTime = DISABLE;
if (HAL_CAN_AddTxMessage(&hcan1, &txHeader, txData, &txMailbox) != HAL_OK) {
Error_Handler();
}What Are the Differences Between CAN, CAN FD, and CAN XL?
Evolution of CAN standards:
- Classic CAN (ISO 11898 Part 1): Up to 1 Mbps, 8 byte payload, 2,048 or 536M message IDs. The established standard in all vehicles.
- CAN FD (ISO 11898 Part 1:2015): Up to 8 Mbps data phase, 64 byte payload, backward compatible with classic CAN transceivers. Adopted in new vehicle platforms since 2020.
- CAN XL (CiA 610): Up to 20 Mbps, 2,048 byte payload, bridging CAN and Ethernet domains. Designed for service oriented architectures.
- CAN FD provides 8x the payload and 8x the data rate of classic CAN, reducing bus load significantly for ECU reprogramming and diagnostic data.
- CAN XL adds a content type field, enabling native tunneling of TCP/IP, PDUs, and other protocols over the CAN physical layer.
How Does CAN Handle Errors and Fault Confinement?
CAN implements five error detection mechanisms: bit monitoring (comparing sent vs received bits), bit stuffing (after 5 same polarity bits), CRC check (15 bit polynomial), frame format check (fixed form fields), and ACK check (at least one receiver must acknowledge). When an error is detected, the detecting node transmits an error frame (6 dominant bits) that corrupts the current message, triggering retransmission. CAN's fault confinement mechanism uses two counters, Transmit Error Counter (TEC) and Receive Error Counter (REC), to classify nodes as Error Active (normal), Error Passive (reduced priority), or Bus Off (disconnected). This mechanism prevents a faulty node from continuously disrupting the network, which is essential for vehicle safety.
Key takeaway: CAN bus is the foundational automotive network protocol, using nondestructive bitwise arbitration to guarantee highest priority message delivery without data loss. Classic CAN supports 1 Mbps with 8 byte payloads, CAN FD extends to 8 Mbps with 64 byte payloads, and CAN XL bridges to Ethernet with 20 Mbps and 2048 byte payloads for next generation vehicle architectures.
What Are Best Practices for CAN Bus Network Design?
Reliable CAN bus operation requires careful attention to physical layer design. Use a linear bus topology (not star or ring) with 120 ohm termination resistors at both ends of the bus line. For CAN FD at 5 Mbps, keep stub lengths under 30mm and total bus length under 40 meters (compared to 500 meters for classic CAN at 125 kbps). Use twisted pair cabling with characteristic impedance of 120 ohms and a propagation delay under 5 ns/m. Route CAN lines away from high current power cables to minimize electromagnetic interference. Implement bus off recovery in firmware: when a node reaches Bus Off state (TEC exceeds 255), wait for the 128x11 bit recovery sequence, then reinitialize the CAN peripheral with exponential backoff to prevent immediate reentry into Bus Off. Monitor error counters (TEC/REC) in your telemetry and alert when they exceed 96 (Error Passive threshold), indicating developing physical layer or protocol issues before they cause Bus Off conditions.
How Does CAN Security Fit Into Modern Vehicle Architectures?
Classic CAN has no built in authentication or encryption, making it vulnerable to message injection, replay attacks, and ECU spoofing. Any node on the bus can send any message ID, and legitimate ECUs cannot distinguish authentic messages from injected ones. Modern vehicle security addresses this through SecOC (Secure Onboard Communication), defined in AUTOSAR, which adds a Message Authentication Code (MAC) to CAN frames. SecOC truncates CMAC AES 128 to fit within CAN payload constraints, providing message authenticity and freshness checking using a synchronized counter. CAN FD's larger 64 byte payload simplifies SecOC integration by providing sufficient space for both data and authentication fields without requiring multi frame protocols. For new vehicle architectures, automotive Ethernet (100BASE T1) with MACsec or IPsec handles high bandwidth, security critical domains like ADAS and V2X, while secured CAN FD remains the standard for body control, powertrain, and chassis domains where deterministic latency and cost per node matter.


