CAN Error State Diagram

CAN Protocol Error States or Error Confinement Mechanism

The Error states in CAN protocol is nothing but the Error confinement Mechanism. It can detect any type of error in CAN by using the internal error detection mechanism. But CAN protocol is having a special mechanism for managing all the errors in a CAN network or bus so that without any hesitation it can work seamlessly.

Detection Of Errors In CAN Protocol

Each and every CAN controller is having an on-chip error detection mechanism. If any node will detect an error at the time of transmission or reception of a message, the discovering node will transmit an error flag or error frame. This will help in destroying CAN bus traffic. The other nodes also detect the error caused by the error flag, if they have not detected the original error. This helps in taking appropriate action in rejection of that message.

Detection Of CAN Protocol Error States

Whenever the node will send an error frame or flag, it will keep the track of this status in a buffer register. This register is basically an 8 – bit volatile memory. Each CAN controller is having its own register. That is handled in VLSI chip design time. So you no need to worry about CAN driver programming. This feature handled on-chip by VLSI engineers. In each CAN controller is having two registers.

  1. Transmit Error Counter Register (TEC): Which counts the number of transmission errors detected on the frames that the ECU sends.
  2. Receive Error Counter Register (REC): Which counts the number of receiption errors detected on the frames that the ECU receives.

It works as a normal counter from 0 – 255. Whenever any node will detect an error and send an error frame, it will increase its counter value. If there is a successful message after an error flag, then it will decrease its counter value. The increase or decrease of TEC or REC counter value purely depends on its error happened in Transmitter ECU or receiver ECU. There are several rules governing how these counters are incremented or decremented. This is defined in the last block of this article.

These counters are maintained to handle the different error states so that a node can recover from its error state to a normal state. Even if the controller can manage the communication properly as per its error value stored in TEC or REC register. So that the node can notify its error states. The error notification is standardized in a triangle, based on the CAN error state. This can define or change the behavior of that ECU or node with the state of this node.

Therefore, a node can be in one of the three possible error states:

  • CAN Error Active State.
  • CAN Error Passive State.
  • CAN Bus-Off State.
can error states
CAN Protocol Error States

CAN Protocol Error Active State

Both of its error the counters are less than 128 (REC < 128 & TEC < 128). It takes part fully in bus communication and signals an error by the transmission of an active error frame. This consists of a sequence of 6 dominant bits followed by 8 recessive bits, all other nodes respond with the appropriate error flag, in response to the violation of the bit stuffing rule.

An error-active node will transmit an ACTIVE Error flag. An error active node can normally take a part in bus communication and sends an active Error frame when an error has been detected. If the error counter value reaches 96 (TEC = 96 or REC = 96), it gives a warning signal.

CAN Protocol Error Passive State

A node goes into an error passive state if at least one of its error counters is greater than 127 ((TEC > 127 | REC > 127) and TEC <= 255). It still takes part in bus activities, but it sends a passive error the frame only, on errors. Furthermore, an error passive node has to wait an additional time (Suspend Transmission Field, 8 recessive bits after Intermission Field) after transmission of a message, before it can initiate a new data transfer. The primary passive error flag consists of 6 passive bits and thus is “transparent” on the bus and will not “jam” communications.

An error-passive node will transmit a PASSIVE Error flag. An error PASSIVE node takes a part in bus communication like an error active flag, but after a transmission, that error-passive node will wait before initiating a further transmission. That means after the error passive frame sent, it sends eight recessive bits following with the INTERMISSION frame fields, before starting to transmit a further message or recognizing the bus to be idle. If, meanwhile, another ECU or node starts a transmission, the node will become the receiver of this message.

CAN Protocol Bus-Off State

If the Transmit Error Counter of the CAN controller exceeds 255 (TEC > 255), it goes into the bus off state. It is disconnected from the bus (using internal logic) and does not take part in the bus activities anymore. In order to reconnect the protocol controller, a so-called? Bus Off? recovery sequence has to be executed. This usually involves the re-initialization and configuration of the CAN controller by the host system, after which it will wait for 128 * 11 recessive bit times before it commences communication.

A bus-off node is not allowed to have any transmission or reception of any CAN message on the bus. That means physically connected and logically disconnected ECU or node on the CAN bus. There is no such error flag for this. Once any ECU enters into this state, it will not be a part of this bus communication until it recovers from this state.

CAN Error confinement Mechanism

  1. When a receiver detects an error, the REC will be increased by 1, except when the detected error was a Bit Error during the sending of an Active Error Flag or an Overload Flag. 
  2. When a receiver detects a dominant bit as the first bit after sending an Error Flag, the REC will be increased by 8.
  3. When a transmitter sends an Error Flag, the TEC is increased by 8. Exception 1: If the transmitter is Error Passive and detects an ACK Error because of the not detecting a dominant ACK and does not detect a dominant bit while sending its Passive Error Flag. Exception 2: If the transmitter sends an Error the Flag because a Stuff Error occurred during arbitration, and should have been recessive, and has been sent as recessive but monitored as dominant.
  4. If the transmitter detects a Bit Error while sending an Active Error Flag or an Overload Frame, the TEC is increased by 8.
  5. If a receiver detects a Bit Error while sending an Active Error Flag or an Overload Flag, the REC is increased by 8.
  6. Any node tolerates up to 7 consecutive dominant bits after sending an Active Error Flag, Passive Error Flag, or Overload the Flag. After detecting the fourteenth consecutive dominant bit (in case of an Active Error Flag or an Overload Flag) or after detecting the eighth consecutive dominant bit following a Passive Error the Flag, and after each sequence of additional eight consecutive dominant bits, every transmitter increases its TEC by 8 and every receiver increases its REC by 8.
  7. After successful transmission of a frame (getting ACK and no error until EOF is finished), the TEC is decreased by 1 unless it was already 0.
  8. After the successful reception of a frame (reception without error up to the ACK Slot and the successful sending of the ACK bit), the REC is decreased by 1, if it was between 1 and 127. If the REC was 0, it stays 0, and if it was greater than 127, then it will be set to the value between 119 and 127.
  9. A node is Error the Passive when the TEC equals or exceeds 128, or when the REC equals or exceeds 128. An error condition letting a node become Error Passive causes the node to send an Active Error the Flag.
  10. A node is Bus Off when the TEC is greater than or equal to 256.
  11. An Error Passive node or ECU becomes Error Active again when both the TEC and the REC values are less than or equal to 127.
  12. A node which is the Bus Off is permitted to become Error Active (no longer Bus Off) with its error counters both set to 0 after 128 occurrences of 11 consecutive recessive bits have been monitored to the bus.

CAN Protocol Bus-Off Hitting Time

The CAN Protocol Confinement mechanism are conceived to disconnect the defecting nodes from the network. This will help in prevention of the other nodes or whole network from bus-off. But however there are certain conditions under which the several nodes can go onto the bus-off state just because of transmission errors for severe electromagnetic interference. Thus it is important to estimate the probability of such events which can be achieved by the average hitting time of the CAN bus-off state and the variance of the bus-off hitting times. To calculate this, there is a model designed having TEC with a Markov chain in continuous time called as Markov Process.

CAN BUS-OFF Failure Modes

  1. CAN_H interrupted.
  2. CAN_L Interrupted.
  3. CAN_H shorted to battery voltage.
  4. CAN_L shorted to ground.
  5. CAN_H shorted to ground.
  6. CAN_L shorted to battery voltage.
  7. CAN_L shorted to CAN_H wire.
  8. CAN_H and CAN_L interrupted at the same location.
  9. Loss of connection to termination network.

PiEmbSysTech Request Message for You!!!

If you feel that you are getting some help from PiEmbSysTech, then, please give your comments below for more improvement suggestions. It will really help us to write the topics well so that everyone can understand. Our aim is to share knowledge all over the world that is not been available or most of the engineers are not able to understand or clear their doubts in their engineering study time.

Subscribe
Notify of
5 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Scroll to Top