TEC & REC in CAN Bus: Values, States & Significance
Advertisement
Introduction : The Controller Area Network (CAN) bus relies on robust mechanisms to ensure reliable communication between various electronic control units (ECUs). Among these, the Transmit Error Counter (TEC) and Receive Error Counter (REC) play a crucial role in maintaining network stability. These internal counters continuously monitor the health of each node, tracking transmission and reception errors, and triggering specific actions to prevent faulty nodes from disrupting the entire network. Understanding how TEC and REC work, including their values, error states and significance, is essential for anyone working with CAN bus systems.
What are TEC and REC ?
TEC (Transmit Error Counter) and REC (Receive Error Counter) are internal counters located within a CAN Controller. They function as a “health score” for a CAN node (ECU).
- TEC: Tracks errors encountered when the node is trying to send a message.
- REC: Tracks errors encountered when the node is trying to receive a message.
Significance : Fault Confinement
The primary significance of these counters is Fault Confinement. In a CAN network, it is vital that a single malfunctioning node does not paralyze the entire bus.
- Self Diagnosis: These counters allow a node to diagnose its own state. If a node realizes it is causing too many errors, it will voluntarily restrict its own communication abilities.
- Network Protection: By monitoring these values, the system ensures that a “healthy” node stays active, a “struggling” node becomes passive (less disruptive), and a “broken” node disconnects itself completely to protect the rest of the network.
Values and Error States
The values of TEC and REC determine which of the three Error States the node is currently in.
| State | Counter Values | Significance & Behaviour |
|---|---|---|
| Error-Active | TEC < 128 AND REC < 128 | Normal Operation. The node is healthy. It participates fully in bus communication. If it detects an error, it sends an Active Error Frame (Dominant bits), which destroys the bad message and forces a retransmission for everyone. |
| Error-Passive | TEC ≥ 128 OR REC ≥ 128 | Warning State. The node is encountering frequent errors. To prevent disrupting the bus, it is demoted. If it detects an error now, it sends a Passive Error Frame (Recessive bits), which is “invisible” and does not jam the bus traffic of other nodes. |
| Bus-Off | TEC reaches 255 | Critical Failure. The node assumes it is physically faulty. It physically disconnects from the bus (stops transmitting and receiving) to prevent taking down the entire network. |
Counting Logic (How Values Change)
The counters do not simply count up; they increase based on the severity of the error and decrease when successful.
Increments (Penalties):
- Severe (+8 to TEC): If the transmitter is the one causing the error (e.g., Bit Error, Stuff Error, CRC Error), it takes a hard penalty of +8 because it is actively corrupting the bus.
- Minor (+1): If a receiver detects an error, or if a transmitter creates a minor error (like missing an ACK), the counter increments by only +1.
Decrements (Healing):
- Success (-1): Every time a message is successfully transmitted or received, the respective counter decrements. This allows a node that had a temporary glitch to eventually “heal” and return to the Error-Active state.
Summary: By tracking transmission and reception errors, these counters dynamically adjust the error state of each node, transitioning them through Error Active, Error Passive and Bus Off states based on defined thresholds. These counters ensure that errors are handled gracefully, minimizing disruption and maintaining data integrity across the CAN network, making it a vital aspect of modern automotive and industrial communication systems.
Advertisement
RF