Embedded

CAN bus protocol

By CourseTron Team ·  8 min read ·  Updated Oct 2026 💬 𝕏 in f
Table of Contents
    ? Print / Save as PDF

    In short: CAN bus is a robust, two-wire differential, multi-master serial network where nodes broadcast message-ID frames and win the wire through non-destructive bitwise arbitration, backed by a five-layer error-detection scheme that has made it the backbone of automotive and industrial control for forty years.

    If you have ever wondered how a car's engine controller, ABS module, and dashboard all talk over a single pair of wires without a central switch, the answer is almost always Controller Area Network (CAN). Introduced by Bosch in 1986 and standardized as ISO 11898, CAN was engineered for exactly the environment a passenger vehicle presents: dozens of electronic control units (ECUs), heavy electromagnetic interference from ignition coils and motors, and a hard requirement that the most urgent message — say, a brake fault — always gets through first. This article walks through the physical signaling, the arbitration trick that makes CAN special, the frame format, real automotive use, and the error handling that lets a node take itself offline before it can corrupt the bus.

    Differential Signaling: Why Two Wires Beat One

    CAN uses a twisted pair called CAN_H (high) and CAN_L (low), terminated by a 120 Ω resistor at each physical end of the bus so the characteristic impedance is matched and reflections are damped. The signal is differential: the receiver looks at the voltage difference (CAN_H − CAN_L), not the absolute level. In the recessive state both lines sit around 2.5 V, giving roughly 0 V difference (logic 1). In the dominant state CAN_H is driven to about 3.5 V and CAN_L down to about 1.5 V, a 2 V difference (logic 0).

    The payoff is common-mode noise rejection. A spike from a nearby alternator couples almost equally into both twisted conductors, so it cancels in the subtraction and the data survives. This is the same principle behind RS-485 and differential pairs in high-speed PCB design — tools like Cadence Sigrity and Siemens HyperLynx are routinely used to simulate CAN_H/CAN_L trace coupling and termination on automotive PCBs.

    Key fact: Classical CAN runs up to 1 Mbit/s, but speed trades against length — 1 Mbit/s is limited to roughly 40 m, while 125 kbit/s can stretch to about 500 m, because the dominant bit must propagate to the far node and back within one bit time for arbitration to work.

    CAN_H CAN_L 120Ω 120Ω ECU: Engine ECU: ABS ECU: Dash CourseTron · coursetron.com
    Multi-drop CAN bus: a single twisted pair, 120 Ω terminators at each end, and every ECU listening and talking on the same two wires.

    Arbitration: How the Most Important Message Always Wins

    CAN is multi-master — any node may start transmitting when the bus is idle. Collisions are resolved by bitwise arbitration, and the magic is that the dominant bit (0) physically overwrites the recessive bit (1) on a wired-AND bus. Every transmitter monitors the bus while it sends its 11-bit (or 29-bit extended) identifier. If a node sends a recessive 1 but reads back a dominant 0, it knows another node with a higher-priority (numerically lower) ID is also talking, so it immediately backs off and becomes a receiver.

    Crucially, arbitration is non-destructive: the winning frame is never corrupted and continues without interruption. A message with ID 0x080 (engine torque) will always beat ID 0x200 (door status) because at the first differing bit, 0x080 drives dominant where 0x200 stays recessive. This is why CAN IDs double as both an address and a priority — a design decision that still looks elegant decades later.

    Node A ID 0x080 Node B ID 0x200 Bus (wired-AND) dominant bit wins B backs off CourseTron · coursetron.com
    Node A's lower ID wins the wire; the dominant bit propagates while Node B detects the mismatch and silently withdraws.

    The CAN Data Frame

    A classical data frame is a tightly packed sequence of fields. Understanding each is a common interview question, so here is the standard 11-bit layout:

    FieldBitsPurpose
    SOF1Start-of-frame, dominant, synchronizes receivers
    Identifier11 (or 29)Message priority and content type
    RTR1Data frame vs. remote request
    Control (IDE, DLC)6Extended-ID flag and data length code (0–8)
    Data0–64Up to 8 payload bytes (64 in CAN FD is larger)
    CRC15 + 1Cyclic redundancy check + delimiter
    ACK2Receivers assert a dominant ACK slot
    EOF7End of frame, seven recessive bits

    Note that classical CAN carries at most 8 data bytes — a deliberate choice to keep latency bounded and deterministic. CAN FD (flexible data-rate, ISO 11898-1:2015) later raised the payload to 64 bytes and allowed the data phase to run faster than the arbitration phase, which is why modern vehicles mix both. Payloads are small, so engineers pack signals at the bit level; databases such as DBC files, edited in Vector CANdb++ or Siemens tools, map physical quantities onto byte offsets.

    Automotive and Industrial Use

    In a typical car there are several CAN segments at different speeds: a high-speed 500 kbit/s powertrain bus (engine, transmission, ABS), a lower-speed body bus for doors, lights, and seats, and often a diagnostic bus reachable through the OBD-II connector. Higher-layer protocols ride on top of raw CAN: CANopen dominates industrial automation and medical devices, SAE J1939 runs trucks and heavy equipment, and UDS (ISO 14229) handles diagnostics and firmware flashing. Beyond vehicles, CAN appears in elevators, factory robots, and even avionics subsystems. For readers moving from serial buses, our I2C protocol explainer is a useful contrast — I2C is a short-range, master-driven, single-ended bus, while CAN is a long-haul, multi-master, differential one. See also our UART vs SPI vs I2C comparison for the full embedded bus landscape.

    Key fact: CAN FD can push the data-phase bit rate to 2–8 Mbit/s while keeping the slower arbitration phase, so a 64-byte frame moves far more payload per bus-access without breaking the priority scheme that classical CAN depends on.

    Error Handling and Fault Confinement

    CAN's reliability comes from five independent error checks running on every node: bit monitoring (compare sent vs. read-back), bit stuffing (a stuff bit of opposite polarity after five identical bits), CRC check, form check (fixed-format fields must match), and ACK check. Any failure triggers an error frame that destroys the current message so all nodes stay consistent.

    What keeps a faulty node from jamming the bus forever is fault confinement. Each node keeps a Transmit Error Counter (TEC) and Receive Error Counter (REC). A node starts error-active (can flag errors with dominant bits). When TEC exceeds 127 it becomes error-passive (it may still talk but signals errors only with recessive bits). If TEC passes 255 the node goes bus-off and disconnects itself entirely, protecting the network from a babbling transmitter. This self-isolation is why a single short or a dying transceiver rarely takes down the whole car.

    Error-Active TEC ≤ 127 Error-Passive TEC > 127 Bus-Off TEC > 255 CourseTron · coursetron.com
    Fault-confinement state machine: counters escalate a misbehaving node from active to passive to fully off the bus.

    Hands-on, engineers at a VLSI and embedded design house like Avecas design services verify CAN controller IP with bus-analyzer traces and HIL rigs before silicon, catching stuff-bit and arbitration corner cases in simulation first.

    Ready to build and debug real CAN networks, decode frames on a logic analyzer, and write ECU firmware? Explore CourseTron's embedded and automotive-electronics track on our courses page and start designing fault-tolerant buses yourself.

    Frequently Asked Questions

    Is CAN bus the same as OBD-II?

    No. OBD-II is a diagnostic connector and standard; CAN is one of several physical/protocol layers it can run over. Since 2008, CAN is the mandated signaling layer behind the OBD-II port in most markets.

    Why only 8 data bytes in classical CAN?

    The short, fixed payload keeps worst-case latency bounded and predictable, which matters for real-time control. CAN FD later extended this to 64 bytes when higher throughput was needed.

    What happens when two nodes send the same ID?

    That is a design error. Arbitration cannot separate identical IDs, so both may transmit simultaneously and cause bit errors. CAN IDs must be unique per message across the network.

    How is CAN different from Ethernet?

    CAN is a low-speed, deterministic, priority-arbitrated broadcast bus optimized for short control messages, while Automotive Ethernet offers far higher bandwidth for cameras and infotainment but needs switches and more complex stacks.

    Advertisement