Home Wiki Networks & Communications CAN Bus: The Backbone of Vehicles and Machines
Networks & Communications

CAN Bus: The Backbone of Vehicles and Machines

CAN Bus: The Language of Heavy Machinery and Automation

Inside a large Caterpillar hydraulic excavator, the engine, digging arm, hydraulic system, and operator panel all exchange hundreds of messages per second. The protocol connecting all of these subsystems is CAN Bus.

CAN (Controller Area Network) was developed by Bosch in 1986, originally for the automotive industry to reduce the wiring harness that could stretch over 2 kilometers in a single vehicle. Today it is used in everything from heavy equipment and satellites to medical devices and industrial production lines.

CAN Bus Fundamentals

Physical Layer

CAN operates on a twisted-pair cable with two lines:

  • CAN_H (High)
  • CAN_L (Low)

The signal is the voltage difference between the two lines, which gives CAN excellent immunity to electromagnetic interference. Even if external noise affects both lines equally, the differential voltage remains stable.

Termination Resistors: A 120-ohm resistor must be placed at each end of the bus. Without them, signal reflections corrupt data. This is the most common CAN installation mistake.

Two States: Dominant and Recessive

State CAN_H CAN_L Difference Logic Value
Recessive (idle) 2.5V 2.5V 0V 1
Dominant (active) 3.5V 1.5V 2V 0

The critical rule: Dominant always overrides Recessive. If two devices transmit simultaneously — one sending 0 (Dominant) and the other sending 1 (Recessive) — Dominant wins. This principle is the foundation of CAN arbitration.

CAN Message Frame

Every CAN message is transmitted in a precisely structured frame:

Standard Frame Components (CAN 2.0A)

Field Size Function
SOF (Start of Frame) 1 bit Frame start — always Dominant
Identifier 11 bits Message identity and priority
RTR 1 bit Remote Transmission Request
Control fields 6 bits Data Length Code (DLC)
Data 0-8 bytes Actual payload
CRC 15 bits Data integrity check
ACK 2 bits Reception acknowledgment
EOF (End of Frame) 7 bits Frame end

An important detail: there is no destination address. CAN messages are not directed to a specific device. Every device on the bus receives every message, and each device independently decides which messages are relevant based on the identifier.

CAN 2.0A vs CAN 2.0B

Property CAN 2.0A (Standard) CAN 2.0B (Extended)
Identifier size 11 bits 29 bits
Number of identifiers 2,048 536 million+
Compatibility Simpler Coexists with 2.0A
Use case Automotive, small machines J1939, heavy equipment

CAN 2.0B (Extended Frame) uses a 29-bit identifier — necessary in large networks such as heavy equipment with dozens of electronic control units.

Arbitration: Intelligence Without a Master

In most communication protocols, a master device decides who speaks and when. CAN is different — any device can start transmitting at any moment. What happens when two devices transmit simultaneously?

Non-Destructive Arbitration:

  1. Both devices begin transmitting their identifier bit by bit
  2. Each device monitors the bus while transmitting
  3. If a device sends a Recessive bit (1) but reads a Dominant bit (0) on the bus, it knows a higher-priority device is transmitting
  4. The lower-priority device stops immediately and retries later
  5. The message with the smaller identifier (more leading zeros) always wins

Result: No message is destroyed, and no time is wasted. The highest-priority message passes immediately.

Consider a practical example: an engine oil pressure alarm (ID = 0x010) and an odometer update (ID = 0x7F0) — the oil alarm always wins because its identifier is smaller.

Bit Timing

CAN operates at speeds from 10 Kbps to 1 Mbps. Speed depends on cable length:

Speed Maximum Distance
1 Mbps 40 meters
500 Kbps 100 meters
250 Kbps 250 meters
125 Kbps 500 meters
50 Kbps 1000 meters

Why? Because arbitration requires the signal to travel from the farthest device and return within a single bit time. Longer cables require longer bit periods, which means lower speeds.

Each bit is divided into segments: Sync, Propagation, Phase 1, and Phase 2. Configuring these segments (Bit Timing Configuration) is essential to ensure all devices sample the bit at the same moment. Most design tools calculate this automatically.

Error Handling: Five Guards

CAN has one of the most robust error detection systems among communication protocols:

Five Detection Mechanisms

  1. CRC check: Every frame contains a 15-bit CRC. The probability of an undetected error is less than 1 in 10 million.
  2. Form check: Validates the frame structure (SOF, EOF, ACK fields)
  3. ACK check: If no device acknowledges reception, the sender knows there is a problem
  4. Bit stuffing: After 5 consecutive identical bits, an opposite bit is inserted. Violating this rule signals an error.
  5. Bit monitoring: The sender compares what it transmitted with what it reads back from the bus

Error States

Every CAN device maintains two error counters: Transmit Error Counter (TEC) and Receive Error Counter (REC):

State TEC/REC Behavior
Error Active < 128 Normal participation, sends Error Active frames
Error Passive 128-255 Participates cautiously, sends Error Passive frames
Bus Off TEC > 255 Disconnects from the bus entirely

This system prevents a faulty device from flooding the network with errors. A malfunctioning device automatically isolates itself.

J1939 Protocol: The Language of Heavy Equipment

SAE J1939 is a protocol running on CAN 2.0B (29-bit identifiers) and is the global standard for heavy equipment:

  • Trucks: Volvo, Mercedes, MAN
  • Construction equipment: Caterpillar, Komatsu, Liebherr
  • Agricultural machinery: John Deere, CLAAS
  • Power generators: Cummins, MTU

J1939 Identifier Structure

The extended identifier (29 bits) is divided into:

Field Bits Function
Priority 3 bits 0 (highest) to 7 (lowest)
PGN (Parameter Group Number) 18 bits Data type identifier
Source Address 8 bits Who sent the message

Parameter Group Numbers (PGN) are globally standardized. For example, PGN 61444 is engine speed (RPM) on any diesel engine supporting J1939.

CANopen Protocol: For Industrial Automation

CANopen (EN 50325-4) is an application-layer protocol running on CAN, designed for industrial automation and particularly motion control:

Core CANopen Concepts

  • Object Dictionary: Every device contains a "dictionary" of parameters addressed by Index and Sub-index
  • SDO (Service Data Object): For reading and writing device parameters — slow but reliable
  • PDO (Process Data Object): For real-time data transfer — very fast
  • NMT (Network Management): For managing device states (operational, stopped, pre-operational)
  • SYNC: A periodic synchronization message ensuring all devices update simultaneously
  • Heartbeat: A periodic "alive" message from each device

J1939 vs CANopen Comparison

Criterion J1939 CANopen
Sector Heavy equipment, transport Industrial automation
CAN identifier 29-bit (extended) 11-bit (standard)
Device profile Mandatory and standardized Flexible via EDS/DCF files
Network management Address + Name NMT + Heartbeat
Data transfer PGN + SPN PDO + SDO
Typical speed 250 Kbps 125-1000 Kbps

Common Problems and Solutions

Problem Likely Cause Solution
No communication at all Missing termination resistor Add 120-ohm resistor at each end
Intermittent errors Cable too long for selected speed Reduce speed or shorten cable
Single device Bus Off Wrong bit timing configuration Verify all devices use the same baud rate
Lost messages Bus overload (>70% utilization) Split across two buses or reduce transmission rate
CAN_H or CAN_L broken Cable damage Inspect with oscilloscope — differential signal should be visible

Tools for Working with CAN

  • CAN analyzers: PCAN-USB from Peak Systems or CANalyzer from Vector — essential for diagnostics
  • Oscilloscope: For inspecting physical signal quality
  • Open-source software: python-can, can-utils (Linux) — excellent for learning and testing

Summary

CAN Bus is one of the most successful communication protocols in engineering history — simple, robust, and intelligent in managing priorities and errors. J1939 made it the global language of heavy equipment, and CANopen extended its reach into industrial automation. For any engineer working with mechanical equipment or production lines, understanding CAN is not a luxury — it is a fundamental requirement.

CAN-bus J1939 CANopen frame arbitration node شبكة CAN بروتوكول J1939 الإطار التحكيم العقدة المعدات الثقيلة