Abnormal Analysis and Solution CAN bus multi-node communication

A, CAN physical layer characteristics

CAN transceiver action is responsible for conversion between the logic level and the signal level. That is flat from the CAN control output logic chip to a CAN transceiver, and then through the internal CAN transceiver converter converts the logic level of the differential signal output to the CAN bus, the node on the CAN bus can decide whether the own needs bus data .

Transceiver used commercially (e.g.: VP230, TJA1040, TCAN337 etc.) mostly ISO 11898 standard. In this standard, the signal generating logic CAN 1 and 0: When CAN_H is 3.5V, CAN_L of 1.5V, 2V difference is approximately expressed as dominant (for dominant) level, and both are equal to 2.5V is recessive or so (recessive) level represents 1.

 

 

When the image above you can see the first paragraph is recessive, CAN_H and CAN_L level is almost the same, that is to say CAN_H and CAN_L level very close to or even equal, when the bus recessive, rather than the potential difference between the two lines when the performance of large dominant, in accordance with the definition:

  • CAN_H - CAN_L <0.5V when recessive, the logic signal appears as "logic 1" - a high level.
  • CAN_H - CAN_L> 0.9V dominant time, the logic signal appears as "logical 0" - low.

CAN bus using rules "line" is a bus punching. I.e., 1 = 0 & 0; 0 so dominant. This means that the phrase implies, as long as there is on the bus if a bus node is pulled low (logic 0), i.e. the dominant state of the bus to a low level (logic 0), i.e. the dominant state, No matter how many nodes on the bus is transmitting a recessive state (high or logic 1) only when all nodes are high (recessive), the bus was high, i.e., recessive.

Two 120Ω resistors as a termination of the CAN bus terminal the impedance is continuous, eliminate reflections.

Two, CAN bus three-node communication anomaly

test tools:

1. PC side: CAN module using the USB to the PC as a mount to the CAN bus node transceiver model TI's VP230;

2. ECU: As used herein, TI MSP432 microcontroller's, since the circuit board is not a CAN transceiver, so here external transceiver VP230;

3. ARM Development Board: Development Board has two embedded CAN channels, the transceiver uses a NXP TJA1040.

 

Problems 1: ARM subscriber board (node ​​1, the transceiver: tcan337) and ECU (node ​​2, the transceiver: vp230) two nodes can be a normal CAN communication, but on the bus that was added the third node PC terminal (node ​​3, USB to cAN module, the transceiver: vp230), the communication abnormality occurs, nodes 1 and 3 can be normal transmit and receive data buses, the bus node 2 can receive data, but can not send data.

 

 

For a question, the use of ARM development board, the ECU, two PC nodes tests were carried out and three-node test, the test results show that the two nodes of the communication between the PC and the ARM, the ECU did not have any problems; use two PC side and ARM , respectively, constituting a communication between the ECU 3 nodes were also normal; two cAN channels and PC using ARM development board constituting 3 nodes are normal; PC configured with two ECU 3 nodes are normal. However, when the ECU ARM Boards and simultaneously mounted to the CAN bus, communication abnormality occurs.

Problems 2: ARM Development Board (node ​​1, the transceiver: TJA1040) and the MCU (node ​​2, the transceiver: vp230) when two nodes CAN communication, after the last data transmission node 1, the bus will remain in the occupied state, after which the node 1 not transmit and receive data buses, the node 2 has read data bus.

 

 

Problem 3: when two PC nodes communicate with the ECU, the communication is normal, but when the development board ARM access bus off state, the communication bus is abnormal, the ECU can not receive data from the PC terminal; and when the bus access work when ARM development board in a state, where the problem of abnormal same bus 1.

 

 

Third, the problem causes abnormal three-node communication CAN bus analysis and solution

CAN physical layer is characterized by a clear understanding, CAN_H, CAN_L ground voltage are about 2.5V, by actual measurement, ARM CAN bus recessive end of the ground voltage is about 2.3V, PC recessive CAN bus ends in a recessive state, ground voltage is about 2.2V, and the ECU end recessive CAN bus ground voltage is about 1.5V, the voltage due to the difference bus, CAN bus voltage to ground is forced low, resulting in the CAN controller can not properly recognize the data bus .

当ECU端的收发器VP230的供电由3.3V更改为5V后,其总线隐性对地电压约等于2.3V,此时ARM、ECU、PC间的任意两节点、三节点通信均正常。

四、CAN总线4、5节点通信测试

为了进一步了解多节点CAN总线通信,将总线上的节点数增加至4节点和5节点,在实际测试中,利用ARM开发板上的2个CAN通道(NXP公司的TJA1040收发器)、2个 USB转CAN模块(TI公司的VP230)、1个ECU(TI公司的VP230)分别进行了各式组合,构成4节点CAN通讯均正常,但是任意5节点通信均出现异常情况,分别由各个节点发送数据,总存在一些节点无法接收到数据。

通过对CAN总线的物理层分析,认为造成这种现象可能有两个原因,一是不同型号的CAN收发器之间通信匹配的问题,二是CAN总线的驱动能力不足造成的。

为了进一步验证上述问题,利用两块ARM开发板上4个CAN通道(NXP公司的TJA1040收发器)进行测试,测试结果发现3个CAN通道可正常通信,但是4节点出现通信异常,异常现象和5节点通信时的问题相同。

由此分析可知,不同收发器的驱动能力会有一些差异,但是这并不是造成此现象的原因。而对CAN总线物理层结构特性进一步了解,总线需要在终端连接两个120欧电阻,但是通过对所有测试点的电路检测可知,每个节点收发器的CAN_H与CAN_L之间均连接了1个120欧电阻,而CAN通信时仅需在总线终端各加1个电阻即可。

将总线中多余的120欧电阻去掉,而只保留两个节点的电阻,通过测试发现,此时的4节点、5节点通信均正常。

那为什么只在物理上最远的两个节点加这个匹配电阻,而不是在所有的节点都加上匹配电阻?

高频信号传输时,信号波长相对传输线较短,信号在传输线终端会形成反射波,干扰原信号,所以需要在传输线末端加终端电阻,使信号到达传输线末端后不反射。对于低频信号则不用。

CAN总线两端必须连接终端电阻才可以正常工作,终端电阻应该与通讯电缆的阻抗相同,典型值为120欧姆。终端电阻的作用,一方面就是吸收信号反射及回波,而产生信号反射的最大来源便是阻抗不连续以及不匹配。另一方面,如果是加在单独的两根线上,相当于一个开环的状态,根据产生信号反射的来源,也就是说这种连接方式会导致单线上阻抗更加不连续,在末端突然变为0,会导致反射成倍增加。高速CAN所加的两个120欧的电阻实际上模拟的是线束连接无穷远的时候在传输线上产生的特性阻抗(而不是实际阻抗),这是个典型经验值,具体值取决于所采用的线束类型。CAN低速之所以不加终端电阻,是因为不同的频率时,同样的连接方式所产生的信号反射和回波差异很大,频率越高,反射和回波就会越强烈。另外不同的频率下,传输线的特性阻抗是不同的。第三方面,当一个显性位发送到至少包含一个CAN驱动处于开启状态的网络上时,意味着有电流经过终端电阻,因此,CAN_H和CAN_L具有了不同的电压值。也就是说,在显性状态时,终端电阻会稳定并增强差分电压,当去掉一个或两个终端,通过示波器可以明显看到一是信号不稳,二是差分电压会有变化,缺少终端或没有终端电阻时所测到的电压是单纯由CAN驱动器所产生的,离发送端越远,电压差异越大。

Guess you like

Origin www.cnblogs.com/HanCui/p/Han.html