CAN Bus
Controller Area Network, arbitration ID.
The Controller Area Network (CAN bus) is a robust serial communication protocol originally developed for automotive applications but now widely used in industrial automation, robotics, and medical devices. Unlike I2C or UART, CAN is a multi-master bus with built-in error detection and a message-priority-based arbitration mechanism that makes it extremely reliable in noisy environments. It is an important topic for GATE ECE and students specializing in embedded and automotive systems.
Core Concept of CAN Bus
CAN bus uses a differential signaling pair called CAN_H and CAN_L. In the dominant state (logic 0), CAN_H is pulled to approximately 3.5 V and CAN_L to 1.5 V, giving a differential voltage of 2 V. In the recessive state (logic 1), both lines float to the same level around 2.5 V, giving near-zero differential voltage. This differential nature makes CAN extremely immune to common-mode noise, which is why it works in the electrically harsh environment of automotive wiring harnesses.
CAN is a multi-master bus, meaning any node can initiate a transmission when the bus is idle. When two nodes attempt to transmit simultaneously, bitwise arbitration resolves the conflict without any data loss or corruption. Each CAN message begins with an Arbitration ID. The node transmitting the lower ID value wins arbitration because dominant bits (0) override recessive bits (1) on the bus. A transmitting node that loses arbitration automatically switches to receiver mode and retries later.
CAN messages in the standard frame format (CAN 2.0A) use an 11-bit Arbitration ID. Extended frame format (CAN 2.0B) uses a 29-bit ID. The data frame also includes a 6-bit Data Length Code (DLC), 0 to 8 bytes of payload data, a 15-bit Cyclic Redundancy Check (CRC), ACK slot, and end-of-frame delimiter. The CRC makes CAN one of the most error-resilient serial protocols available.
Mathematical Expression: Bit Rate and Bit Time
The CAN bit time is divided into four segments: Synchronization Segment (Sync_Seg), Propagation Segment (Prop_Seg), Phase Buffer Segment 1 (Phase_Seg1), and Phase Buffer Segment 2 (Phase_Seg2). The total bit time is the sum of all these segments multiplied by the Time Quantum (TQ), which is derived from the oscillator clock and a prescaler. The bit rate is the reciprocal of the total bit time.
The formula for CAN bit rate is: Bit Rate = 1 / Bit Time, where Bit Time = (Sync_Seg + Prop_Seg + Phase_Seg1 + Phase_Seg2) x TQ, and TQ = Prescaler / f_clock.
Given:
Oscillator frequency f_clock = 16 MHz
Prescaler = 4
Sync_Seg = 1 TQ, Prop_Seg = 3 TQ, Phase_Seg1 = 4 TQ, Phase_Seg2 = 4 TQ
Why this formula applies:
CAN bit rate depends on how the system clock is divided and how each bit time segment is configured.
Formula:
TQ = Prescaler / f_clock
Bit Time = (Sync + Prop + Phase1 + Phase2) x TQ
Bit Rate = 1 / Bit Time
Substitution:
TQ = 4 / 16,000,000 = 250 ns
Bit Time = (1 + 3 + 4 + 4) x 250 ns = 12 x 250 ns = 3000 ns
Calculation:
Bit Rate = 1 / 3000 ns = 1 / 0.000003 s
Final Answer: CAN Bit Rate = 333.33 kbpsExam Tip: In CAN arbitration, a node transmitting a recessive bit (1) that sees a dominant bit (0) on the bus knows it has lost arbitration and stops transmitting immediately. The message with the numerically lower 11-bit ID always wins. This is non-destructive arbitration and no data is ever lost.
- Both nodes begin transmitting simultaneously when the bus is idle, starting from the MSB of their respective Arbitration IDs.
- At each bit position, the node compares what it transmits with what it reads back from the bus. Dominant (0) overrides recessive (1).
- The node that transmitted recessive but read back dominant knows it lost arbitration and immediately stops transmitting.
- The winning node continues transmission without interruption; no part of its message is corrupted or lost.
- CAN's five built-in error detection mechanisms include bit error, stuff error, CRC error, form error, and acknowledgement error, making it extremely reliable in noisy systems.
Quick Revision
- CAN uses differential signaling: CAN_H and CAN_L. Dominant state has 2 V differential; recessive state has near-zero differential.
- CAN 2.0A uses 11-bit Arbitration ID; CAN 2.0B uses 29-bit extended ID.
- Lower Arbitration ID = higher priority. Non-destructive bitwise arbitration means no data loss.
- Termination: 120 ohm resistors at each end of the bus to prevent signal reflections.
- CAN Classic max bit rate is 1 Mbps. CAN FD (Flexible Data Rate) supports up to 8 Mbps in data phase.
- Five error types: bit error, stuff error, CRC error, form error, ACK error.
- Common trap: In CAN, all nodes receive all messages. Filtering is done by the receiving node in software or hardware, not by the bus itself.
CAN Bus Quiz
Test your understanding of CAN bus arbitration and frame structure.
Q1.In a CAN bus network, two nodes simultaneously transmit frames with arbitration IDs 0x1A3 and 0x1A1. Which node wins arbitration?
Related Articles
UART
Asynchronous serial protocol, baud rate, framing.
9 min read
SPI
Synchronous serial, master-slave, clock polarity/phase.
9 min read
Embedded Systems Overview
Definition, constraints, design metrics.
9 min read
Inter-Task Communication
Queues, Semaphores, Mutexes.
8 min read
Accelerometers
MEMS sensor basics, I2C interface.
8 min read