
CAN Bus
Error Handling
Error handling is built into in the CAN
protocol. Each node maintains two error counters: the Transmit Error Counter
and the Receive Error Counter. Using the error counters, a CAN node can
not only detect faults but also perform Error Confinement.
CAN
Bus Error Detection Mechanisms
1. Bit Monitoring.
2. Bit Stuffing.
3. Frame Check.
4. Acknowledgement Check.
5. Cyclic Redundancy Check.
CAN Bus
Error Confinement
The CAN bus is capable to distinguish
between temporary erratic errors and continual erratic errors.
A node starts out in Error
Active mode. When any one of the two Error Counters raises above
127, the node will enter a state known
as Error
Passive and when the Transmit Error Counter raises above 255, the node
will enter the Bus Off state.
• Error
Active node will transmitActive Error Flags when it detects
errors.
• Error
Passive node will transmit Passive Error Flags when it detects
errors.
• Bus
Off node is
disabled from transmit/receive operations.
Transmit errors give 8 error points
Receive errors give 1 error point
Correctly transmitted and/or received
messages causes the counter(s) to decrease.
Whenever a node tries to transmit a
message, if for whatever reason fails it will increases its Transmit Error
Counter by 8 and transmits an Active Error Flag. Then it will attempt to
retransmit the message, and if it fails will increment by 8 points the Transmit
counter. Above 127 (i.e. after 16 attempts), this node goes Error Passive and
from this moment it will transmit Passive Error Flags on the bus. A Passive Error Flag will not affect other bus traffic,
the other nodes won’t hear the faulty node complaining about bus errors.
However, the faulty node continues to increase its Transmit Error Counter and
once above 255 it will go into Bus Off.
Error state
of a node unit | Transmit error counter
(TEC) | Receive error counter (REC) |
Error active
state | 0 – 127 | AND | 0 – 127 |
Error passive state | 128 – 255 | OR | 128 – 255 |
Bus off state | Minimum 256 | | – |
|
|
|
|
|
For every active error flag that
transmitted by a faulty node, the other nodes will increase their Receive Error
Counters by 1. By the time that a faulty node goes Bus Off, the other nodes
will have their Receive Error Counters below Error Passive limit (127). This
count will decrease by one for every correctly received message the faulty node
being in Bus off state.
| Transmit/receive
error counter change conditions | Transmit error counter (TEC) | Receive error counter (REC) |
1 | When the receive unit
has detected an error, except when the receiveunit detected a bit error while it was sending an active-error flag or overload flag. | – | +1 |
2 | When the receive unit has detected a dominant level in the firstbit that it received after sending an error flag. | – | +8 |
3 | When the transmit unit
has transmitted an error flag 1) | +8 | – |
4 | |