How Can I Detect an Abnormality in the CAN Bus using XNET Device?

Updated Apr 27, 2023

Reported In

Hardware

  • NI-9860

Software

  • LabVIEW

Driver

  • NI-XNET

Issue Details

I'm using 9860, NI CAN device that uses the NI-XNET API. Due to the nature of the test, a short may occur in the CAN bus. Even if the hardware enters an abnormal state, the hardware can be used normally by initializing the XNET session. However, to get the hardware back to normal quickly, I really need to know when something went wrong on the bus. Error logs appear immediately for CAN devices from other vendors, but CAN devices from NI do not. How can I detect abnormalities on the bus?

Solution

If a device sending CAN data enters the Bus Off state, it will no longer send data. If the node is in the Bus Off state, you need to reset CAN device by software or hardware reset. You can use the API below to know this state.

You can use this API, XNET Read.vi, by connecting to the XNET session you're using, and you can see what state it is in the communication state of the CAN comm indicator.