Why Is My CAN in the Bus Off State?

Updated Nov 27, 2024

Reported In

Software

  • VeriStand
  • LabVIEW

Driver

  • NI-XNET

Issue Details

  • Why does my CAN application regularly goes into the "Bus off State"?
  • I am running a diagnostic session (using Automotive Diagnostic and Command Set toolkit) and the CAN interface transition to bus off state, how can I reset the interface?

Solution

The CAN application is in bus off state when the condition of LED 1 is solid green and LED 2 is solid red.

If the "transmit error counter" is above 255, the CAN interface transitions into this state. Communication immediately stops under the assumption that the CAN interface must be isolated from other devices.
This can be caused when the cable is disconnected or faulty, or if the noise level was high that CAN High and CAN Low lines were disturbed.

When a CAN interface transitions to the bus off state, communication stops for the interface. All NI-XNET sessions for the interface no longer receive or transmit frame values. To restart the CAN interface and all its sessions, call XNET Start.vi in LabVIEW or nxStart in C.

 

To reset bus off state that occur during diagnostic session using Automotive Diagnostic Command Set Toolkit, you can create a parallel XNET session that is monitoring communication state and restart the interface as necessary. The XNET session need to run with the same baud rate as diagnostic session.


In VeriStand, you can enable Check for communication state and restart automatically option under Interface tab to restore from Bus Off State without redeployment.
VeriStandXNET.png

Additional Information

The transmit error counter begins at 0 when communication starts on the CAN interface. The counter increments when an error is detected for a transmitted frame and decrements when a frame transmits successfully. The counter increases more for an error than it is decreased for success. This ensures that the counter generally increases when a certain ratio of frames (roughly 1/8) encounter errors.

When communication state transitions to Bus Off, the transmit error counter no longer is valid.