What Happens If Two Node ID Segments Are The Same?

- Apr 04, 2018-

What happens if two node ID segments are the same?

CAN-bus networks do not allow two nodes to have the same ID segment in principle, but what happens if the two node ID segments are the same?

Before the experiment,we must  have a clear understanding of the structure of the CAN messages and the principles of arbitration.

First, CAN message structure

The most widely used CAN-bus network standard is the V2.0 version. This standard is further divided into A and B parts. Their main difference is the ID code length in the arbitration area. Among them CAN2.0A (standard frame) is 11 bit ID, CAN2.0B (expand frame) is 29 bit ID. Table 1 below shows the structure of the CAN message:

Table 1 CAN message structure

Phase NamePhase length/bitDescription
SOF1means   data phase start,and make up by single dominant bit 
Abtrition PhaseStandard frame12Indicates   the priority of the frame,make up by 11 ID addresses and 1 RTR
extended frame32Indicates   the priority of the frame,make up by 29 ID addresses,1 bit SRR,IDE extended   and RTR
Control Phase6means   the group code and reserved bits of the data length of the data segment
Data Phase0~8data   content,control phase control the data length
CRC16check   frame transimission erro,from SOF to data phase,all the contents,except   filling bits
ACK2other   node confirm this frame to be received correctly
Frame End7means the frame end

Second, the principle of arbitration

CAN bus arbitration is based on "line and principle", as shown in Figure 1. When a transceiver emits signals of different levels at the same time, the recessive level is always covered by the dominant level. While sending the message, the CAN controller will monitor whether the bus status is the same as the one sent by itself. If the inconsistency occurs in the ID segment, arbitration will occur. If it occurs in other areas, the corresponding error will be triggered.

The following is the key point. What if the two node ID segments are the same? We started the experiment with two CAN cards and one CANScope. The CAN card simulates the CAN standard node to send and receive messages, and the CANScope does the communication monitoring, as shown in Figure 2.



                                                               Fig.2 Experiment Platform Construction

Third, experiment one "The ID segment is the same but the data is different"

A CAN card is used to send a CAN frame with ID 000H data to 01020304050607H and another CAN card to send a CAN frame with 000H data to 02020304050607H. The data that CANScope listens on is shown in Fig. 3. It can be observed that there are a large number of data field filling errors.


                                           Fig.3 Data field fill erro

Why is this so? We first obtain the waveforms corresponding to the two CAN card transmission messages, as shown in Figure 4. Because the two-pin message is a standard data frame and each frame contains 8 bytes of data, the waveforms corresponding to the two frames of packets are exactly the same in the ID segment, RTR, IDE, R0, and DLC segments. Therefore, the role of arbitration is ineffective and both nodes consider themselves as having priority and continue to send data.


Now we focus on the data segment, the first byte data is the same, are 00H; the second byte data is different, respectively 01H, 02H. The arrows in Figure 5 indicate that the logic of the corresponding bits is 0 and 1 respectively. Earlier we mentioned that the CAN node will detect whether the bus level is the same as the level it sent when sending the message. If the inconsistency occurs in the non-arbitration area, the corresponding error is triggered, so if the two frames are sent to the bus at the same time Bit errors must occur. Because the bit sending error will cause the node to send 6 dominant bits that violate the filling rule (the active error destroys the frame data), the data field filling error occurs, as shown in FIG. 3 .


                                          Fig.5 Data Field Conflicts 

Fourth, experiment two "the same data with the same ID"

At the same time, use two CAN cards to send CAN frames whose ID is 000H data to 01020304050607H, and CANScope does communication monitoring. First of all, we do not check the "bus response" option to make CANScope work in listen-only mode. The experimental results are shown in Figure 6, and the response delimiter is in the wrong format.


                                                                           Fig.6 Response delimiter format error

Why does this happen? The node sending the message will send two recessive bits in the ACK segment. If a dominant level is received during the first bit, the frame is considered to be correctly received. Because the two arbitrators think that they have obtained the arbitration right when they have the same arbitral segment, they wait for a response in the ACK segment, but there are only two nodes in the network. Therefore, no response can be received in the ACK segment, and a response delimiter error occurs. Simply speaking, this situation is similar to the fact that only one node in the bus will not be able to send data. Figure 7 shows the waveform comparison when there is no response in the ACK segment.


                                                                           Fig.7 ACK Reply

We check the bus response and start the experiment again (at this time there are 3 nodes in the bus). At this time, as shown in FIG. 8, the bus data is transmitted and received normally.


                                                                             Fig.8  Start BUS  Reply                    

Summary: When two nodes send packets with the same ID and data at the same time, a data field padding error occurs. When two nodes send packets with the same ID and the same data, no error occurs if other nodes respond. Other nodes responded with a response error. Therefore, we should avoid the same situation in the ID segment when designing the CAN bus.

Previous:RS485 And RS232 Debug Experience Sharing Next:Experience To Reduce RS485 Bus Communication Failures