Article count:1510 Read by:4577717

Featured Content
Account Entry

Introduction to CAN bus error frames and troubleshooting methods

Latest update time:2023-02-21
    Reads:

Author | Jianjia

Editor | Not enough to eat
There are many formats of CAN frames. Error frames are a unique type of CAN frames. Understanding their functions, types and causes will be very helpful for testing and development. This article will cover the basic knowledge of error frames and subsequent Analysis and troubleshooting are introduced.

01
Basics of Error Frames

The role of error frames
The error frame is a message used by the CAN bus for error notification. It can notify other nodes of the error found by any node, including the sending node; then discard the error message, and the sending node will resend the message to ensure delivery. Accuracy of information.

error type

Figure 1CAN layered architecture

First of all, as shown in the figure above, according to the layered concept, CAN error detection and error signal transmission are on the second layer, that is, the data link layer. Therefore, the messages detected by error detection are also the messages detected by the data link layer. arts.

Secondly, when an error occurs in the frame on the bus, the node will send out an error frame, and there are many types of errors:

bit error


Bit errors are errors issued by the sending node when it sends data, reads it back, and detects that the data on the bus is different from the data it sent. Due to CAN's arbitration mechanism and ACK response mechanism, recessive bits are sent out at the arbitration field and ACK, and when the dominant bits are read back, it will not be considered a bit error.
Figure 2 bit detection

wrong format


A format error is an illegal bit detected in a fixed-format bit field. For example, the ACK delimiter is fixed to be a recessive bit. If a dominant bit is detected, it is considered a format error.
Figure 3 Format detection

ACK error


When the sending node detects recessiveness in the ACK bit of the message sent by itself, it will think that no other node has received the message, which is an ACK error.
Figure 4 ACK detection

padding error


The filling mechanism of CAN is to fill in an opposite bit every time 5 consecutive identical bits are detected to provide enough transition edges for synchronization. When there is a message on the bus, 6 consecutive identical bits are detected. bit, it is considered a stuffing error.
Figure 5 Fill detection

CRC error


When the CRC sequence received by the receiving node is different from the CRC sequence sent by the sending node, it is recognized as a CRC error.
Figure 6 CRC detection

Error frame type

The types of CAN errors have been mentioned above. When an error is detected, an error frame will be sent. The error frame formats sent by nodes in different error states are different.

From the perspective of errors, nodes have three different states, namely active error state, passive error state and bus off state. There are two different error counters, namely the receive error counter REC and the transmit error counter TEC. When a node detects an error, it will send out an error frame and increase the value of the error counter. Depending on the value of the error counter, the node will enter different states. For the specific counting algorithm, refer to ISO 11898-1.
Figure 7 Node state transition diagram

When the values ​​of TEC and REC are both less than 128 , when the node is in the active error state, the error frame sent by the node consists of 6 dominant bits (active error flag) plus 8 recessive bits (error delimiter), a total of 14 bits . When a node sends an error frame, other nodes will send error frames after recognizing it. This mechanism notifies other nodes of the error detected by one node, and also prevents other nodes from receiving erroneous messages.

When TEC or REC is greater than 127 , when the node is in the passive error state, the error frame sent by the node consists of 6 recessive bits (passive error flag) plus 8 recessive bits (error delimiter), that is, 14 consecutive recessive bits Composed, when a node in the passive error state detects an error when receiving a message and sends an error frame, it will be overwritten by normal messages or error frames from other nodes. Only when the node in the error-passive state actively sends out messages, the error frames sent out will be normally detected by other nodes and trigger other nodes to send error frames.

When TEC is greater than 255 and the node is in the bus off state (busoff), the node will stop sending and receiving messages until there is a user request (such as restart) or the bus appears 11 consecutive recessive bits 128 times in a row, and the node recovers. to an active error state. The main purpose of the bus off state is to prevent one node from continuously sending error frames when it fails or is continuously interfered with, thus affecting the normal sending and receiving of messages by other nodes.

In summary, there are only two categories of error frames according to specific formats, namely 6 explicit 0 + 8 recessive 1 and 6 recessive 1 + 8 recessive 1. When a node continuously detects multiple errors and enters the passive error mode, it is very likely that the node has a problem or is interfered with. At this time, the errors detected by this node may not be trusted, so it is in the passive error mode. The error frame sent by the mode node has 14 recessive bits, which can be overwritten by normal messages or normal error frames.


02
Main causes of error frames on real cars

For real vehicles, error frames may occur mainly due to the following reasons:

????Terminal resistor mismatch: The terminal resistor is used to match the impedance characteristics of the cable and reduce signal reflection. When the terminal resistor does not match the impedance of the bus, the reflection phenomenon will be more serious and affect the results.

Bus resistance 75Ω
Bus resistance 40Ω
Bus resistance 60Ω
Figure 8 Effects of different resistors on waveforms

???? The impact of capacitance on waveform: Capacitance mismatch will affect the rising and falling edge times of the level, thereby affecting the sampling results. If the bus capacitance is too large, the discharge time will increase and the falling edge time will increase, which will affect the final sampling result.


Figure 9 Effects of different capacitances on waveforms

???? The impact of branch line length: If the branch line length is too long, it will affect the impedance matching of the bus, and the reflection will be more serious, which will affect the waveform on the bus.

???? Node where the sampling point is inappropriate. When the sampling point positions of nodes on the bus are set inconsistently, error frames may occur.

???? The power supply has relatively large electromagnetic interference. Large electromagnetic interference will affect the waveform of the bus, thereby affecting the messages on the bus and causing error frames.

Summary: The occurrence of error frames on real vehicles is generally caused by poor waveforms and fluctuations in the waveform, which in turn affects the sampling results and causes error frames.


03
Examples of troubleshooting methods for error frames

To investigate the cause of the error frame and observe the type of error frame and other information, you can use Vector's software tool CANoe, oscilloscope, multimeter, etc. You can see the detailed information of the message, error type, etc. in the Trace window of CANoe.

When an error frame occurs on a real vehicle, based on the reasons for the error frame, you can refer to the following typical troubleshooting methods.

???? First determine whether the terminal node is online, load DBC to determine whether there are messages from the terminal node, or use a multimeter to measure whether the terminal resistor value is correct.

Figure 10 Determine whether the node is online


???? Confirm the frequency of error frames, whether they are periodic or only occur within a fixed period of time.

???? When an error frame occurs, check whether the corresponding message has a fixed ID or a fixed node.

???? Based on the information of the error frame, check whether it is related to the normal message; at the same time, combine the retransmission and the priority of the message for comprehensive analysis.

Figure 11 Impact of priority on error frames



04
Conclusion

Through the above introduction, I believe readers have a certain understanding . For testing, understanding the types of error frames, and then analyzing the causes of errors, problems that arise during testing, and analysis of test results are all methods that can be referenced.


 
EEWorld WeChat Subscription

 
EEWorld WeChat Service Number

 
AutoDevelopers

About Us Customer Service Contact Information Datasheet Sitemap LatestNews

Room 1530, Zhongguancun MOOC Times Building,Block B, 18 Zhongguancun Street, Haidian District,Beijing, China Tel:(010)82350740 Postcode:100190

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号