CAN Bus Guide

CAN Bus Guide – Error Frame

A Comprehensible Guide to Controller Area Network (CAN Bus) by Wilfried Voss
Click on image for Table of Content

An error frame initiates the termination of a faulty data or remote frame. This is actually accomplished through an intended violation of the CAN standard.

For purposes of synchronizing the time bases between all nodes in a network (see Chapter 7 - Data Transfer Synchronization) the CAN standard allows only 5 consecutive bits of the same polarity between the SOF bit and (including) the CRC Field of a message frame; every bit stream of more than 5 bits of the same polarity, dominant or recessive, is considered an error condition. As a matter of fact, CAN uses this rule to send an error frame, which contains of (minimum) 6 consecutive dominant bits. Each node in the network will recognize the violation of the standard and initiate the appropriate response.

In order to transmit or receive data that contains more than 5 bits of the same polarity the CAN standard requires the insertion (by the sending node) and filtering (by the receiving) of a complimentary bit of reversed polarity, the so-called Stuff Bit (see also Chapter 7.2 - Bit Stuffing).

Error Frame 1
Picture 4.7.1: Basic Error Frame Architecture
An error frame signals the detection of an error condition by a receiving or transmitting node (see also Chapter 8 - Error Detection and Fault Confinement). The intended violation of the CAN standard (i.e. the sending of 6 dominant bits) guarantees the destruction of a faulty data or remote frame.

As shown in picture 4.7.1 the error frame consists of the 6 bit error flag and an 8 bit error delimiter. However, it demonstrates only the basic error frame according to the CAN standard.

As previously mentioned, a sequence of more than 5 consecutive bits of the same polarity between the SOF bit and (including) the CRC Field is considered an error condition. An error frame, posted by any number of nodes, will be recognized as an error condition by all other nodes in the network. In turn they, too, will send an error frame to the bus.

The actual posting of the error frames may occur at different times from node to node. As a result, the actual error flag, as it occurs on the bus, may be constructed by a superposition of several error frames.

Error Frame 2
Picture 4.7.2: “Realistic” Error Frame Architecture
As shown in picture 4.7.2, the actual error flag length will be between 6 and 12 bit times. The total error frame length will be between 14 and 20 bit times. Using these numbers plus the Interframe Space length of 3 bits it is possible to determine the total error recovery time in a CAN network.

Error Frame Length Baud Rate Total Error Recovery Time
[Error Frame + Interframe Space]
14 bits 1 MBit/sec 14 + 3 µsec
  500 kBit/sec 28 + 6 µsec
  250 kBit/sec 56 + 12 µsec
20 bits 1 MBit/sec 20 + 3 µsec
  500 kBit/sec 40 + 6 µsec
  250 kBit/sec 80 + 12 µsec 

Table 4.7.1: Error Recovery Times

Such short error recovery times are one of the many advantages of CAN when compared to other fieldbus protocols.

As shown in table 4.7.1 the error recovery time in a CAN network is very short; the actual time depends primarily on the chosen baud rate, but also on the actual bit length of the error frame.

In order to prevent a defective node from continuously reporting errors and therefore blocking the entire CAN bus, the CAN standard defines two different error reporting rights, error-active and error-passive. Such a defective node will switch from error-active to error-passive mode and, unless the node was repaired, eventually will remove itself from the bus (self-retirement). A transmitting, but error-passive node can report the termination of its own message to the bus, but it cannot destroy any message it received from other nodes (see also Chapter 8 - Error Detection and Fault Confinement).

Advertisement