Analysis of inconsistency between waveform decoding and message decoding based on CAN bus signal
“Using CANScope to measure the CAN bus signal, in the case of serious interference, the CAN bus waveform decoding and CAN message decoding may be inconsistent. The specific manifestation is that the waveform decoding corresponding to some correct messages is wrong, or the received The waveform decoding corresponding to the error message is correct. As shown in Figure 1, the waveform decoding corresponding to the correct message with the frame ID of 0x721 is a CRC error. This article will explain in detail the reasons for this phenomenon and the significance of its existence.
Using CANScope to measure the CAN bus signal, in the case of serious interference, the CAN bus waveform decoding and CAN message decoding may be inconsistent. The specific manifestation is that the waveform decoding corresponding to some correct messages is wrong, or the received The waveform decoding corresponding to the error message is correct. As shown in Figure 1, the waveform decoding corresponding to the correct message with the frame ID of 0x721 is a CRC error. This article will explain in detail the reasons for this phenomenon and the significance of its existence.
Figure 1 Inconsistency between message decoding and waveform decoding
1. The main reasons for decoding discrepancy errors
CANScope’s processing of CAN signals includes two parts: a message processing part and a waveform processing part. The message processing part converts the CANH and CANL differential signals on the bus into a single-ended digital signal RXD through the CAN transceiver, and then uses a dedicated CAN controller to receive the RXD signal and decode the CAN protocol, and finally receive the decoded message. Storage: The waveform processing part isolates the CAN bus signal through the signal conditioning circuit, and then digitizes the analog signal through the ADC circuit and saves it in sequence to complete the acquisition of the waveform signal.
Figure 2 CAN bus signal processing
As shown in Figure 2, the circuits and controls of the message processing and waveform processing are completely independent. The CAN signal will be different after passing through these two circuits. The main differences are: 1. The signal delay after passing through the transceiver The delay time is different from that of the signal conditioning circuit, but this difference has little impact on decoding, which is not discussed in this article; 2. There is a hysteresis comparator inside the CAN transceiver, which has the function of a low-pass filter and can pass The signal bandwidth is not high, and the waveform acquisition requires a relatively high bandwidth of the signal conditioning circuit due to the need to observe high-frequency interference and other signals, so the difference in bandwidth has a greater impact on the difference in subsequent decoding.
As shown in Figure 3, the bus signals CANH and CANL with high-frequency spike interference signals, after passing through the low-bandwidth transceiver, the interference signals carried by them are filtered out (the output RXD signal is a digital signal without interference) ; and the same CANH and CANL signals, after passing through the high-bandwidth signal conditioning circuit, the interference signals carried by them are still retained (after the waveform acquisition module collects the disturbed CANH and CANL signals, after software differential, the obtained differential signal There is still interference, so the logic signal after software conversion still has interference).
Figure 3 Waveform Difference
According to the above analysis, the existence of the interference signal makes the subsequent CAN waveform decoding different from the message decoding. Let’s continue to dig deeper: Is there any interference signal that will definitely cause the waveform decoding to be different from the message decoding? In fact, it is not the case. It has to start with the sampling rules of the CAN bus.
2. CAN bus sampling rules
The CAN controller first prescales the high-frequency clock to generate a lower-frequency clock signal. The cycle of this clock signal is defined as 1 time share, and the symbol width of a 1-bit CAN signal contains several times of the time share, such as If the clock frequency of the controller is 16MHz and the prescaler is the clock of 8MHz, then 1 time quantum is 125ns. For the CAN signal of 1M baud rate, the symbol width of 1 CAN signal is 8 time quantums.
Taking 1 time share as the minimum unit, the 1-bit CAN signal symbol is divided into 3 segments: synchronization segment, phase segment 1, and phase segment 2. The synchronization segment is fixed as 1 time quantum, the phase segment 1 and the phase segment 2 can be set to different parameters, and the controller samples the CAN bus between the phase segment 1 and the phase segment 2.
Figure 4 Sampling point location
When the position where the interference signal appears is not at the sampling point, the decoding will not cause errors due to interference. Only when the interference signal is just at the sampling position, the decoding will cause errors due to interference.
Figure 5 Interference location
The CAN bus usually works in a relatively harsh environment, and there are often interference signals. In order to ensure the consistency of decoding when the CAN bus is networked, it is required that the sampling point settings of all nodes should be consistent. The two circuits of message processing and waveform processing in CANScope can be regarded as two CAN nodes. The sampling point position of CANScope’s waveform decoding is consistent with the sampling point position of message decoding. However, when high-frequency interference signals appear At the sampling point position, even if sampling is performed at the same sampling point position, there is a high probability that waveform decoding and packet decoding are inconsistent due to the difference in bandwidth between the waveform processing and message processing circuits.
3. Software logic filtering
CANScope adopts software filtering method, that is, software filtering is performed on the digital signal after software differential and logicalization of the collected CAN bus analog waveform signal. The signal bandwidth allowed to pass after filtering varies with the baud rate. The smaller the rate, the smaller the allowable signal bandwidth after filtering; through such filtering processing, the tolerance to interference signals is maximized, and the waveform can still be correctly decoded even in the case of packet decoding errors. In this way, in the case of serious interference, the phenomenon mentioned at the beginning of the article may occur that the message is decoded correctly but the waveform is decoded incorrectly, or the message is decoded incorrectly but the waveform is decoded correctly.
Fourth, the significance of the existence of decoding differences
People who have used CAN cards may have the impression that in the process of using CAN cards, it is almost impossible to encounter the phenomenon that some nodes receive correct messages and some nodes receive incorrect messages, because only one node (in error The node in the active state) receives the error message, and all other nodes will receive the error message, at most, the type of error is different. This is different from the difference between CANScope’s message decoding and waveform decoding. What is the reason for this? This is because in a normal CAN network, when a node decodes an error, it will send an error frame to the bus to destroy the current message, resulting in all nodes receiving the error message. The difference is that CANScope, as a measuring device, only monitors and collects the CAN bus without affecting the CAN bus, and displays the details of the waveform on the bus (including the decoding differences caused by the details of the waveform) as much as possible. This is exactly the decoding process. the meaning of the difference.
Figure 6 Decoding errors do not affect the bus
As shown in Figure 6, the CAN bus is seriously disturbed, and the decoding of CANScope’s message is wrong, but at this time CANScope does not send an error frame to the bus, and other nodes have no decoding error, the current frame is responded normally and the transmission is completed normally. The situation can be fully revealed by waveform and waveform decoding without affecting the CAN bus network.
Using CANScope to measure the CAN bus signal, in the case of serious bus signal interference, the CAN waveform decoding and CAN message decoding will be inconsistent. This is due to CANScope’s independent two-channel message processing and waveform processing. The measurement equipment only monitors the CAN bus silently, does not affect the CAN bus, and displays the waveform details on the bus (including the decoding differences caused by the waveform details) as much as possible. This is the value of CANScope.
The Links: NL10276BC28-11A CM200RL-24NF