CAN Bus Off Explained: TEC, REC, Error Passive and the Error Flags of Fault Confinement

Key takeaways

  • Every CAN node keeps two error counters. A transmit error adds 8 to TEC and a receive error adds 1 to REC.
  • A counter above 127 makes a node error passive. TEC above 255 takes it bus off.
  • An error-passive node sends 6 recessive bits as its error flag and waits 8 extra bits before transmitting.
Light trails on a curving highway at night under the words CAN Fault Confinement
Light trails on a curving highway at night. Image: Techqio

Thirty-two transmit errors in a row are enough to take a node off the network. That state is CAN bus off, and it is the last step of a mechanism called fault confinement. To run it, the CAN controller of every node on a CAN bus network keeps two 8-bit registers.

One register counts transmit errors and is called TEC, the Transmit Error Counter. The other counts receive errors and is called REC, the Receive Error Counter. Both exist to confine faults on the bus.

How the TEC and REC counters change

A counter goes up when an error occurs and comes down when a frame goes through without a fault. Once TEC or REC passes a set value, the node moves into a different state that keeps the error under control. The counters follow these rules:

CounterEventChange
TECThe transmitting node sends an error flagTEC + 8
TECA frame is transmitted successfullyTEC – 1
RECA receiving node sends an error flagREC + 1
RECA receiving node sends the first error flagREC + 8
RECA frame is received successfullyREC – 1
Bar graph of transmit errors in a row: 16 errors to reach error passive (TEC above 127) and 32 errors to reach bus off (TEC above 255)
Bar graph with bars of 16 and 32 transmit errors. Image: Techqio. Source: CAN fault confinement rules: +8 per transmit error, limits of 127 and 255

A transmitting node raises its TEC faster than a receiving node raises its REC. The transmitter sends the message itself, so a fault is easier to find there. Kvaser’s tutorial sums up the gap as 8 error points for a transmit error and 1 for a receive error. At 8 points apiece, 16 transmit errors in a row push TEC past 127, and 32 push it past 255.

The three node states, from error active to CAN bus off

TEC and REC put a node in one of three states: error active, error passive or bus off. Error active is the normal communication state. A node in it that detects an error puts an error flag of 6 dominant bits (‘0’) on the bus.

State diagram of a CAN node: error active and error passive linked by TEC or REC above 127 and both at 127 or below, bus off reached at TEC above 255 and left after a soft reset and 11 recessive bits 128 times
State diagram of error active, error passive and bus off. Image: Techqio

A counter above 127 makes the node error passive, which takes 16 error frames. Transmitting is restricted, but the node keeps sending and receiving messages. With no further errors and both counters back at 127 or below, it returns to error active. Kvaser’s lesson on error handling lists an earlier signal as well, an error warning when one or both counters are above 96.

A faulty node that keeps sending errors until TEC passes 255, which takes 32 error frames, goes bus off. Shutting it out of communication is how the protocol removes the fault from the network. CAN bus off does not cut the physical connection. The node returns to error active after the application restarts, a soft reset, and 11 recessive bits have appeared 128 times.

How active and passive error flags differ

CAN has two forms of the error flag that follows a detected error, and the node’s state decides which one goes out. An active error flag is 6 consecutive dominant bits (‘0’). A passive error flag is 6 recessive bits (‘1’), unless another node’s dominant bits overwrite it.

Timing drawing of two signal lines over six bit cells: the active error flag line drops low for 6 dominant bits (0), the passive error flag line stays high for 6 recessive bits (1)
Two signal lines across six bit cells, one low and one high. Image: AI-generated with ChatGPT

An error-active node that detects an error has to tell the other nodes on the bus, so it transmits dominant bits. An error-passive node may not take priority over any other activity on the bus.

It sends 6 recessive bits even when it has detected an error. CAN FD frames, standardized with classical CAN in ISO 11898-1:2024, also carry an error state indicator bit that is recessive when the sender is error passive.

Suspend transmission: the extra wait for a passive node

An error-passive node, the kind that sends recessive error flags, is also at a disadvantage when it wants the bus. Even after the 3 intermission (ITM) bits end normally, it is not allowed onto the bus and has to wait 8 more bits. CiA, the CAN industry association, lists that wait as the 8-bit suspend transmission of an error-passive node.

Two CAN frame ends: an error-active node can transmit right after the 3-bit intermission, an error-passive node only after an added 8-bit suspend transmission field
Two frame ends, the lower one with an 8-bit suspend transmission field. Image: Techqio

So a passive node gets the bus only when no other node is trying to access it.

What a rising counter says about a node

Fault confinement works because the protocol charges a sender more than a listener. A transmit error costs 8 points and a good frame earns back only 1. A node with a real fault climbs fast, while a node that hit a stray disturbance drifts back down.

So when a node goes silent, read its transmit counter first. A node that only listens on a noisy bus collects receive errors and stays on the network. The node that disappears is the one whose own frames kept failing, and that is where to look for the fault.

Sources

Share this article

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *