Why Is My CAN in the Bus Off State?

Updated Jul 11, 2022

Reported In

Software

  • VeriStand
  • LabVIEW

Driver

  • NI-XNET

Issue Details

Why does my CAN application regularly goes into the "Bus off State"?

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.

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.