CAN Error Detection





Types of errors:


There are generally five types of errors handled by the CAN node during communication. These are as below:

  • Bit Error -
        The Bit error is detected in the CAN node when the received bit value is different from the bit which is actually sent.
  • Acknowledgment Error -
        Whenever a transmitting node sends the recessive bit in the ACK Slot and checks for the dominant bit to verify the reception,
    in that case, Acknowledgement Error occurs.
  • CRC Error -
       When a CAN node receives a message, it will calculate the CRC and then verify it against the CRC sequence which is received
    by the transmitter node. If the CRC sequence doesn't match then it will raise the CRC error.
  • Form Error -
        A Form error is detected when a fixed-form bit field contains one or more illegal bits. It is generally generated in the case when
    the dominant bit is detected in the bit field where it should not be like CRC delimiter, ACK delimiter, EOF(End Of Frame) field,
    or Interframe space.
  • Stuff Error -
       The Stuff error is raised whenever the bit stuffing rule is violated which means 6 consecutive bits of the same polarity are detected.


Errors Detection:


Whenever an error is detected then the CAN network will immediately signal the error to the respective node instead of sending the
acknowledge message. There are three main protocols implemented by the CAN protocol at the message level for detecting errors
during CAN communication.

  • Frame Check -
       In this method, the structure of the transmitted frame is verified by checking its bit fields against the fixed format and frame size.
  • ACK errors -
       When a CAN node receives a message then it will send the acknowledgment message to the transmitter frame. But due to some
    reason if the transmitter node doesn't receive the acknowledgment then it will inform the network by ACK error.
  • CRC or Cyclic Redundancy Check -
       When the message is prepared for transmitting then for safeguarding the information a frame check sequence (FCS) was added
    in the CAN message frame. On the receive side, this FCS is recomputed and checked with the received FCS. If there is a mismatch in
    the FCS then the CRC error will be signaled.


Errors at Bit Level:


For error detection at the bit level, the CAN protocol uses two mechanisms as explained below:

  • Bit Stuffing -
       CAN message encoding follows the "Non-Return to Zero (NRZ) " rule. In this coding technique, the synchronization edges are
    generated by bit stuffing. It means that after every five consecutive similar bits, a stuff bit of opposite polarity should be inserted in
    the bit stream. This stuff bit will be removed by the receiver while decoding the message.
  • Monitoring -
       The CAN message transmitter's ability to error detection is based on monitoring the bus signals. Every CAN node that transmits the
    message also observes the bus level and detects the difference between the bit sent and the bit received.


Error Signalling:

A CAN node detects an error condition and informs or signals this by transmitting an "ERROR FLAG ". For an active error node, it is
an ACTIVE ERROR FLAG and for a passive error node, it is a PASSIVE ERROR FLAG. Wheever a BIT ERROR, FORM ERROR, ACK ERROR,
or STUFF ERROR is detected by the node, transmission of an ERROR FLAG is started at the respective node at the next bit. When a
CRC ERROR is detected, the transmission of an ERROR FLAG starts at the bit following the ACK DELIMITER, unless an ERROR FLAG of
another condition has already been started.