bus error management in controller area nework rev 1 · pdf filebus error management in...

4
Bus Error Management in Controller Area Network (CAN) Bus The Controller Area Network (CAN) Bus A Controller Area Network (CAN) bus is an electronic instrumentation bus. It is a shared bus on which a participating node can broadcast an electronic message known as a “CAN frame”. Within a typical implementation the bus has three wires; one is the ground, and the other two carry differential CAN signals. The nodes are connected to the bus though a transceiver. The CAN frame transmitted by a node is received by all the nodes on the bus including the transmitting node. While the receiver nodes acknowledge the correctly received CAN frame, the transmitting node monitors the bus for a change in the transmitted bit value. There is no node hierarchy on the CAN bus. The Message ID portion of the CAN frame determines the importance of the message rather than the node. The lower the value of the message ID, the higher the importance of the message therefore on a CAN Bus a logical ‘0’ is the dominant bit while a logical ‘1’ bit is the recessive bit. If two or more nodes simultaneously transmit the ‘0’ bit is transmitted. On a CAN bus any node can transit a frame while the bus is idle. If two nodes simultaneously start transmitting a frame arbitration grants priority to the node of higher importance and sends the frame while the node with the low importance frame stops transmission. Bus Errors There can be many sources of an error on a CAN bus. Since it is used in critical applications it is important that it continues to operate at all times. This is achieved at the physical layer by a transceiver which operates when one of the wires is broken. At the data link layer the protocol mandates that the defective node withdraws from communication. Fault confinement is a critical aspect of the CAN which is achieved by a defective node identifying itself and switching to the bus-off state. A node can identify five types of errors for transmitted or received frames. These errors are defined as Form error, Stuff Error, CRC Error, Bit Error and Acknowledgment Error. A Transmitter detects Bit error and Acknowledgment Error, while a Receiving Node detects Form Error, Stuff Error and CRC Error. CAN Frame Figure 1 shows a CAN frame containing no errors. The figure is a screen capture of simulation of an ESG IP for CAN 2.0B (Active) using the Quartus II Simulator Tool. Various waveforms shown represent the actual signals and registers in the CAN 2.0B IP. The CAN_SIGNAL is a simulated tri state representation of the CAN Bus. The STUFF_ERROR, FORM_ERROR, CRC_ERROR, BIT_ERROR and ACK_ERROR signals are signals that are activated upon detection of pertaining error conditions. The IRQ signal becomes active upon the detection of an error condition, frame overflow and successful transmission, or reception of a CAN frame. Contents of IRQ_REGISTER flag the following: Bit 3 – Frame Error Bit 2 – Frame Overflow Bit 1 – Frame Received Bit 0 – Frame Transmitted If there was an error in the transmission or receipt of a frame the contents of LAST_ERROR_REGISTER bits 2 to 0 indicate the following: “000” indicates No Error “001” Bit Error “010” Acknowledgment Error “011” Stuff Error “100” CRC Error “101” Form Error. The CAN frame shown here is a Standard Remote frame. The 11 bit Message ID is 10101010101 and DLC is 0101. The CAN bus baud rate is 1Mbps and the grid in the picture has been set to 1micro-second intervals.

Upload: vutuyen

Post on 11-Feb-2018

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Bus Error Management in Controller Area Nework Rev 1 · PDF fileBus Error Management in Controller Area Network (CAN) Bus The Controller Area Network (CAN) Bus ... and the other two

Bus Error Management in Controller Area Network (CAN) Bus

The Controller Area Network (CAN) Bus

A Controller Area Network (CAN) bus is an electronic instrumentation bus. It is a shared bus on which a participating node can broadcast an electronic message known as a “CAN frame”. Within a typical implementation the bus has three wires; one is the ground, and the other two carry differential CAN signals. The nodes are connected to the bus though a transceiver. The CAN frame transmitted by a node is received by all the nodes on the bus including the transmitting node. While the receiver nodes acknowledge the correctly received CAN frame, the transmitting node monitors the bus for a change in the transmitted bit value.

There is no node hierarchy on the CAN bus. The Message ID portion of the CAN frame determines the importance of the message rather than the node. The lower the value of the message ID, the higher the importance of the message therefore on a CAN Bus a logical ‘0’ is the dominant bit while a logical ‘1’ bit is the recessive bit. If two or more nodes simultaneously transmit the ‘0’ bit is transmitted. On a CAN bus any node can transit a frame while the bus is idle. If two nodes simultaneously start transmitting a frame arbitration grants priority to the node of higher importance and sends the frame while the node with the low importance frame stops transmission.

Bus Errors

There can be many sources of an error on a CAN bus. Since it is used in critical applications it is important that it continues to operate at all times. This is achieved at the physical layer by a transceiver which operates when one of the wires is broken. At the data link layer the protocol mandates that the defective node withdraws from communication. Fault confinement is a critical aspect of the CAN which is achieved by a defective node identifying itself and switching to the bus-off state. A node can identify five types of errors for transmitted or received frames. These errors are defined as Form error, Stuff Error, CRC Error, Bit Error and Acknowledgment Error. A Transmitter detects Bit error and Acknowledgment Error, while a Receiving Node detects Form Error, Stuff Error and CRC Error.

CAN Frame Figure 1 shows a CAN frame containing no errors. The figure is a screen capture of simulation of an ESG IP for CAN 2.0B

(Active) using the Quartus II Simulator Tool. Various waveforms shown represent the actual signals and registers in the CAN 2.0B IP. The CAN_SIGNAL is a simulated tri state representation of the CAN Bus. The STUFF_ERROR, FORM_ERROR, CRC_ERROR, BIT_ERROR and ACK_ERROR signals are signals that are activated upon detection of pertaining error conditions. The IRQ signal becomes active upon the detection of an error condition, frame overflow and successful transmission, or reception of a CAN frame. Contents of IRQ_REGISTER flag the following: Bit 3 – Frame Error

Bit 2 – Frame Overflow Bit 1 – Frame Received Bit 0 – Frame Transmitted

If there was an error in the transmission or receipt of a frame the contents of LAST_ERROR_REGISTER bits 2 to 0 indicate the following: “000” indicates No Error

“001” Bit Error “010” Acknowledgment Error

“011” Stuff Error “100” CRC Error “101” Form Error.

The CAN frame shown here is a Standard Remote frame. The 11 bit Message ID is 10101010101 and DLC is 0101. The CAN bus baud rate is 1Mbps and the grid in the picture has been set to 1micro-second intervals.

Page 2: Bus Error Management in Controller Area Nework Rev 1 · PDF fileBus Error Management in Controller Area Network (CAN) Bus The Controller Area Network (CAN) Bus ... and the other two

Figure 1 - A CAN Frame with No Error

Stuff Error

The part of the CAN frame between the Start of Frame (SOF) and the CRC delimiter is covered by bit stuffing rules. The CAN bus does not have synchronization information. The nodes synchronize themselves by changes in the bit levels. Therefore, the CAN frame follows the NRZ-5 coding rule. By this rule the bus level cannot have more than 5 bits of the same level. When there are 5 bits of the same level, the controller automatically generates a 6

th bit of at opposite level. The receiving end looks at the

incoming bits and ignores the sixth bit, if the five preceding bits are of the same level. If the sixth bit is of the same level as the preceding five bits, the receiving controller generates the error frame immediately after the sixth bit of the same level. If the receiving node is in Active Error mode then the generated error frame is Active Error frame by transmitting six dominant bits.

Figure 2 - A CAN Frame with Stuff Error

CRC Error

Each CAN frame includes a 15 bit CRC at the end. These CRC bits are calculated for bits beginning at Start of Frame bit to last bit of the Data Frame. If any errors are found in the calculated CRC of the received frame an Active Error or Passive Error Frame is generated immediately after the Ack Delimiter Bit.

Page 3: Bus Error Management in Controller Area Nework Rev 1 · PDF fileBus Error Management in Controller Area Network (CAN) Bus The Controller Area Network (CAN) Bus ... and the other two

Figure 3 - A CAN Frame with CRC Error

Form Error

The CRC Delimiter, Ack Delimiter, End of Frame, Intermission Frame and Overload Frames have a fixed format. When a receiver receives a bit that is not recessive it generates an error frame immediately following the bit with error.

Figure 4 - A CAN Frame with Form Error

Bit Error

A transmitter monitors the bus while transmitting the frame. The purpose is to stop transmitting the message if the transmitting node loses the arbitration. If the transmitter transmits a recessive bit and receives a dominant bit or vice-versa after the RTR bit it identifies the bit error and generates an error frame immediately after the bit with the error.

Page 4: Bus Error Management in Controller Area Nework Rev 1 · PDF fileBus Error Management in Controller Area Network (CAN) Bus The Controller Area Network (CAN) Bus ... and the other two

Figure 5 - A CAN Frame with Bit Error

Acknowledgment Error

When a transmitter sends a frame on the CAN bus all receivers who receive the frame correctly send a dominant Acknowledgment bit after the CRC delimiter bit. If the transmitter does not see an Acknowledgment bit it sends an error frame following the Acknowledgment bit position.

Figure 6 - A CAN Frame with Acknowledgment Error