How to fix CAN Bit Stuffing Error

Thread Starter

naseeam

Joined Jan 4, 2017
79
Our ADAS Controller is based on Renesas RH850/U2A16 Microcontrollers. We are using Infineon TLE9255WSK Partial Network CAN Transceivers. We are using Vector CANoe Professional.

When a CAN message is transmitted on CAN Channel 2 from our controller to Vector CANoe, there is Bit Stuffing Error. Please see attached filename Bit_Stuffing_error_CAN_Trace.PNG.

Also, attached are files that show our Vector CANoe tool configuration.

We are using 120 Ohms termination resistor.

What might be the problem? Is the problem in Vector CANoe Tool configuration? Or is this problem in CAN Driver source code in our controller?
 

Attachments

Papabravo

Joined Feb 24, 2006
21,159
One thing about CAN is that errors can be ambiguous and point at the wrong culprit. Bit stuffing happens between controllers at the hardware level. Transmitters insert the stuff bits and receivers remove the stuff bits. The immediate conclusion is that you have bad hardware. It is more likely that what looks like a bit stuffing error is actually one of the nodes throwing an "Error Frame" which is constructed to look like a bit stuffing error in that if the node is "Error Active" it will throw an Error Frame" of 7 consecutive dominant bits. If the node is "Error Passive" it will throw an "Error Frame" of 7 consecutive recessive bits. If the node is "Bus Off" it will not do anything at all.

Nodes throw "Error Frames" all the time and the most likely explanation is a discrepancy in bit timing parameters, or trying to match the bit timing parameters of two nodes with different clock frequencies. It is quite difficult to match nodes with clock frequencies of 16 MHz and 18 MHz. Making a poor choice of bit timing parameters is also a possibility.
 

Thread Starter

naseeam

Joined Jan 4, 2017
79
Why multiple senders on the wire might cause this problem?

How to debug that sender is causing this problem?

The problem occurs with Two specific standard CAN Ids. One is transmitted on CAN 1 to Vector CANoe tool and the other is transmitted on CAN 2 to Vector CANoe tool.
 

Papabravo

Joined Feb 24, 2006
21,159
Why multiple senders on the wire might cause this problem?

How to debug that sender is causing this problem?

The problem occurs with Two specific standard CAN Ids. One is transmitted on CAN 1 to Vector CANoe tool and the other is transmitted on CAN 2 to Vector CANoe tool.
Multiple senders is not a problem and can only exist during the time of the arbitration field. A node that is transmitting the identifier with the lowest numerical value will win the arbitration by being the first to transmit a dominant bit. All losing transmitters become receivers continuing to check the validity of the transmitted message. Any receiver on the bus can throw an "Error Frame" as soon as it detects an error, If I was there with you and able to see what is going on, I might be able to help. You need to check the bit timing parameters very very carefully and they must match pretty closely. Tell me what you think they are for both nodes.

You may find the following page helpful:
http://www.bittiming.can-wiki.info/

Next thing to check is cable length and termination
After that, the difference in GROUND potential between the two nodes
 
Last edited:
Top