CAN Bus for Industrial Systems: Reliable Multi-Node Communication Guide

Key Takeaway: CAN bus provides robust, deterministic multi-node communication for industrial automation systems — supporting up to 110 nodes on a single bus with built-in error detection that makes it far more reliable than UART or I2C in electrically noisy factory environments.

CAN Bus Industrial Systems Infographic

1. What Is CAN Bus and Why Industrial Systems Need It

CAN bus (Controller Area Network) was originally developed by Bosch in the 1980s for automotive electronics. Today, it is one of the most widely used communication protocols in industrial automation, connecting PLCs, motor drives, sensors, HMI panels, and I/O modules on a single two-wire bus.

The reason CAN bus dominates industrial environments is simple: reliability under adversity. Unlike UART or SPI, CAN bus uses differential signaling that tolerates electromagnetic interference (EMI) from VFDs, welding equipment, and heavy machinery. Its built-in error detection catches corrupted messages at the hardware level — no software overhead required.

In a typical factory floor scenario, a single CAN bus network connects dozens of devices across hundreds of meters of cable. Each device — whether a stepper motor controller, temperature sensor, or HMI panel — can communicate simultaneously without a central master. This peer-to-peer capability eliminates single points of failure.

2. CAN Protocol Architecture

The CAN protocol operates at two defined layers:

  • CAN 2.0A (Standard): 11-bit identifier, supporting 2,048 unique message IDs
  • CAN 2.0B (Extended): 29-bit identifier, supporting over 500 million unique message IDs

Both versions use a multi-master, message-based protocol — any node can transmit when the bus is idle. The protocol does not use addresses; instead, each message carries an identifier that indicates its content and priority. All nodes receive all messages and filter based on the identifier.

Key protocol parameters:

Parameter Standard CAN (2.0A) CAN FD
Identifier bits 11 11 or 29
Data payload 0–8 bytes 0–64 bytes
Max bit rate (data phase) 1 Mbit/s 8 Mbit/s
Error detection CRC + bit stuffing CRC-17/21 + bit stuffing
Bus length (at 1 Mbit/s) ~40 m ~40 m
Bus length (at 125 kbit/s) ~500 m ~500 m

3. Physical Layer: Wiring and Termination

CAN bus uses a two-wire differential bus: CAN_H (high) and CAN_L (low). The signal is the voltage difference between these two wires, which provides excellent noise immunity — common-mode interference affects both wires equally and is rejected by the receiver.

Physical wiring requirements:

  • Cable: Twisted pair (STP) cable with characteristic impedance of 120 Ω
  • Termination: 120 Ω resistor at each end of the bus (between CAN_H and CAN_L)
  • Maximum nodes: 110 per bus (ISO 11898-2 standard)
  • Maximum bus length: 40 m at 1 Mbit/s, up to 1 km at 10 kbit/s

For factory installations, use shielded twisted pair with the shield grounded at one end only (typically the master/PLC end) to prevent ground loops. Cable runs should avoid parallel routing with power cables or maintain at least 30 cm separation.

4. CAN Message Structure and Arbitration

A standard CAN frame consists of:

  1. SOF (Start of Frame): Single dominant bit
  2. Arbitration field: 11-bit (standard) or 29-bit (extended) identifier + RTR bit
  3. Control field: Data length code (DLC, 0–8 bytes)
  4. Data field: 0–8 bytes of payload
  5. CRC field: 15-bit CRC for error detection
  6. ACK field: Acknowledge slot (all receivers confirm receipt)
  7. EOF: 7 recessive bits

The arbitration mechanism is CAN bus’s most elegant feature. When two nodes transmit simultaneously, they both monitor the bus. If a node transmits a recessive bit (1) but detects a dominant bit (0) on the bus, it loses arbitration and backs off. The node with the lowest identifier value wins and continues transmitting — no data is lost or corrupted during arbitration.

5. CAN FD: Higher Bandwidth for Modern Factories

CAN FD (Flexible Data-rate) extends classic CAN by allowing higher bit rates during the data phase and larger payloads (up to 64 bytes). This addresses the bandwidth limitation of classic CAN without abandoning the existing physical layer.

In a CAN FD frame, the arbitration phase uses the standard bit rate (up to 1 Mbit/s), while the data phase can switch to a higher rate (up to 8 Mbit/s). This “dual-speed” approach means the arbitration and error-detection mechanisms work reliably even over long cables, while data throughput increases dramatically.

CAN FD is particularly valuable in industrial IoT applications where sensor data volumes are increasing — for example, multi-axis CNC machines generating position feedback from multiple encoders at high frequency.

6. Implementing CAN Bus with STM32 Microcontrollers

STM32F4 and STM32G4 series include integrated FDCAN (Flexible Data-rate CAN) peripherals. Here is a basic implementation using STM32 HAL:

// Initialize FDCAN for 500 kbit/s arbitration, 2 Mbit/s data
FDCAN_HandleTypeDef hfdcan;

void CAN_Init(void) {
    hfdcan.Instance = FDCAN1;
    hfdcan.Init.ClockDivider = FDCAN_CLOCK_DIV1;
    hfdcan.Init.FrameFormat = FDCAN_FD_BRS;
    hfdcan.Init.Mode = FDCAN_MODE_NORMAL;
    hfdcan.Init.AutoRetransmission = ENABLE;
    hfdcan.Init.TransmitPause = DISABLE;
    hfdcan.Init.ProtocolException = DISABLE;
    
    // Nominal bit timing: 500 kbit/s at 80 MHz
    hfdcan.Init.NominalPrescaler = 10;
    hfdcan.Init.NominalSyncSeg = 1;
    hfdcan.Init.NominalTimeSeg1 = 13;
    hfdcan.Init.NominalTimeSeg2 = 2;
    
    // Data bit timing: 2 Mbit/s at 80 MHz
    hfdcan.Init.DataPrescaler = 5;
    hfdcan.Init.DataSyncSeg = 1;
    hfdcan.Init.DataTimeSeg1 = 7;
    hfdcan.Init.DataTimeSeg2 = 1;
    
    HAL_FDCAN_Init(&hfdcan);
    HAL_FDCAN_Start(&hfdcan);
}

// Send a motor speed command
void CAN_SendMotorSpeed(uint8_t node_id, int16_t speed_rpm) {
    FDCAN_TxHeaderTypeDef tx_header;
    uint8_t tx_data[8];
    
    tx_header.Identifier = node_id;
    tx_header.IdType = FDCAN_STANDARD_ID;
    tx_header.TxFrameType = FDCAN_DATA_FRAME;
    tx_header.DataLength = FDCAN_DLC_BYTES_2;
    tx_header.ErrorStatePassive = DISABLE;
    tx_header.BitRateSwitch = FDCAN_BRS_ON;
    
    tx_data[0] = (speed_rpm >> 8) & 0xFF;
    tx_data[1] = speed_rpm & 0xFF;
    
    HAL_FDCAN_AddMessageToTxFifo(&hfdcan, &tx_header, tx_data);
}

The STM32 FDCAN peripheral includes hardware message filtering — up to 64 filter banks that can match on ID, ID mask, or ID range. This means the CPU only processes messages relevant to the application, reducing interrupt overhead in multi-node systems.

7. Industrial Use Cases: Motor Drives, PLCs, and Sensor Networks

Motor drive communication: CAN bus connects VFDs (Variable Frequency Drives) and servo amplifiers to PLCs, enabling speed commands, torque references, and status feedback. Brands like Siemens, ABB, and Danfoss offer CAN-enabled drives as standard.

PLC I/O expansion: Remote I/O modules connected via CAN bus reduce wiring costs in large factory installations. A single CAN cable running through a cable tray replaces dozens of individual signal wires.

Sensor networks: Temperature sensors, pressure transducers, and flow meters with CAN interfaces can be daisy-chained along a single bus — ideal for monitoring distributed processes in chemical plants, food processing, and HVAC systems.

CANopen and DeviceNet: Higher-level CAN-based protocols add standardized device profiles, making it possible to mix devices from different manufacturers on the same bus. CANopen is particularly popular in European industrial automation (servo drives, robotics), while DeviceNet is more common in North American manufacturing.

8. CAN Bus vs RS-485, I2C, and Ethernet

Feature CAN Bus RS-485 I2C Ethernet
Max speed 1 Mbit/s 10 Mbit/s 400 kHz 10 Gbit/s
Max nodes 110 32 112 Unlimited
Error detection Hardware CRC Software only ACK bit CRC-32
Determinism Yes (priority-based) No No With TSN
Cable cost Low Low Very Low Moderate
Typical cost/module $2–5 $1–3 $0.50 $10–50

CAN bus sits in the sweet spot between cost and capability for most factory-floor communication needs. When higher bandwidth is required (video, large data transfers), industrial Ethernet becomes necessary — but for sensor data, motor commands, and I/O signaling, CAN bus remains the most cost-effective and reliable choice.

Frequently Asked Questions

What is the maximum distance for CAN bus in a factory?

At 125 kbit/s, CAN bus supports cable runs up to 500 meters. At lower speeds (10 kbit/s), distances up to 1 km are achievable. For longer distances in large factories, CAN repeaters or gateways can extend the bus across multiple segments.

Can CAN bus connect STM32 microcontrollers to a PLC?

Yes. Most industrial PLCs (Siemens S7, Allen-Bradley CompactLogix) include CAN or CANopen modules. The STM32 FDCAN peripheral communicates natively with these PLCs using standard CAN frames or CANopen application-layer protocols. You may need a CAN transceiver chip (MCP2551, TJA1050) between the STM32 and the physical bus.

What is the difference between CAN bus and Modbus?

CAN bus is a physical-layer and data-link-layer protocol (wiring, arbitration, error detection). Modbus is an application-layer protocol (data format, register mapping). CAN-based Modbus implementations exist (CANopen is more common), but they serve different layers of the communication stack.

How do I handle CAN bus errors in industrial systems?

CAN controllers include three error counters: transmit error counter (TEC), receive error counter (REC), and a general error state. When TEC exceeds 255, the node goes “bus-off” and disconnects. Industrial systems implement automatic bus-off recovery with a configurable delay, and log error counts for predictive maintenance.

Is CAN bus suitable for safety-critical applications?

CAN bus itself is not inherently safe for safety-critical applications, but the CANopen Safety protocol (EN 50325-5) adds safety layers including redundant communication, message counters, and timeout monitoring. For SIL 3/PLe applications, CAN-based safety protocols are widely used in industrial machinery.

Sources

  1. ISO 11898-1:2015 — Road vehicles — Controller area network (CAN)
  2. Bosch — CAN Bus Technology Overview
  3. CAN in Automation — CAN FD Specification
  4. STMicroelectronics — STM32 FDCAN Application Note (AN5765)

Disclosure: This post contains affiliate links to recommended CAN transceiver modules and development boards. If you purchase through these links, we may earn a commission at no extra cost to you.

You are currently viewing CAN Bus for Industrial Systems: Reliable Multi-Node Communication Guide