CAN Bus Series Part 8: Error Detection and Recovery Mechanisms

CAN Bus Series Part 7: The “Birth Journey” of CAN Node Circuits and Messages

In the previous section, we learned about the entire process of a CAN message being generated by the MCU, encapsulated by the controller, and then driven by the transceiver onto the bus. But what happens when these messages are interfered with, experience level distortion, or encounter logical errors in the node itself during transmission?

In traditional serial (UART) communication, once an error occurs, the upper layer software needs to re-evaluate and resend. However, in a CAN network, the situation is completely different:

CAN is a “self-healing communication protocol”—it can automatically detect errors, report errors, isolate faulty nodes, and recover communication when conditions allow.

In this section, we will take a look at how this “intelligent defense system” operates.

1. Five Types of Errors in CAN (Error Types)

In the CAN protocol, any node can detect the following five types of errors:

Error Type Trigger Condition Description
Bit Error The node detects that the actual level on the bus does not match what it sent after transmitting a bit. This indicates that the node is inconsistent with the bus state.
Stuff Error Six consecutive bits of the same level (without inserted stuffing bits). Violates the bit stuffing rule.
CRC Error CRC check does not match. The message transmission may have been interfered with.
Form Error Fixed format field error (e.g., CRC delimiter, ACK delimiter). The frame structure is corrupted.
ACK Error No ACK received from other nodes. This indicates that no node has correctly received the message.

🧠 Summary in One Sentence

CAN error detection is not reliant on one node “watching others”, but rather onall nodes “watching each other”. This ensures that errors can be detected within microseconds.

2. Broadcasting Mechanism of Error Frames

When a node detects an error, it does not “silently swallow” it, but immediately inserts a special signal onto the bus—Error Frame.

Error frames consist of two parts:

| Error Flag | Error Delimiter |

Where:

  • Error Flag: Six consecutive dominant (active error) or recessive (passive error) signals;

  • Error Delimiter: 8 recessive bits, used to restore bus idle.

🟡 Active Error Frame

  • Used when the node is in Error Active state;

  • Six dominant bits → immediately interrupt the currently transmitting message;

  • Once all nodes recognize this, they discard the current frame and wait for a retransmission.

⚪ Passive Error Frame

  • Used when the node’s error count is too high (enters Error Passive state);

  • Sent with recessive levels, it will not “interfere” with other nodes’ communication;

  • Indicates that it “consciously reduces its authority” and temporarily only listens.

3. Error Counting and Node State Machine

Each CAN controller has two internal counters:

  • TEC (Transmit Error Counter)

  • REC (Receive Error Counter)

Depending on the type of error and node behavior, the counters will increase or decrease. When the count reaches a threshold, the node state automatically switches:

State Condition Node Behavior
Error Active TEC < 128 and REC < 128 Normal communication, can send active error frames
Error Passive TEC ≥ 128 or REC ≥ 128 Enters passive state, reduces interference
Bus Off TEC ≥ 256 Completely exits the bus, waiting for software reset

💡 Engineering Tip:

When a node enters Bus Off, the controller does not automatically recover; software needs to detect and manually reset the error count to reinitialize CAN.

4. Self-Recovery Mechanism: From Error to Rebirth

The power of CAN lies in its ability to “restart” the communication process in a very short time, even when errors occur.

The process is as follows:

  1. The node detects an error;

  2. Immediately broadcasts an Error Frame;

  3. All nodes discard the current frame;

  4. Wait for a 3-bit interval (Intermission);

  5. Reinitiate arbitration and retransmit the frame.

Therefore,a CAN message can be retransmitted within tens of microseconds after an error, without affecting bus synchronization or communication with other nodes.

5. Conclusion: The Robustness of CAN

In modern in-vehicle networks, the electromagnetic environment is far worse than in ideal laboratory conditions.However, the CAN bus can still maintain reliable communication even during engine ignition, motor interference, and relay activation, thanks to this entiredistributed, real-time error detection and recovery mechanism.

It gives each node a certain degree of “self-reflection” and “self-repair” capability, making CAN truly a “resilient” backbone of in-vehicle communication.

Leave a Comment