How Can I Detect When My CAN Device Is Disconnected?

Updated Jul 30, 2018

Reported In


  • LabVIEW



Issue Details

I have a Unit Under Test and I want to be able to stop sending signals in the event of an accidental disconnection. I tried using the X-NET (CAN Comm State)  and reading the CAN Comm>>communication state. When I disconnect the device, the communication state changes to Error Passive. However, when I reconnect, sometimes it stays in Error Passive rather than Error Active like I expect. How can I monitor accidental disconnection with my CAN device?


The CAN Comm Cluster has a transmit error counter and a receive error counter that will count up when the communication is disrupted. The communication state will transition to Error Passive when the counts are above 127 on either counter and into Bus Off when above 255. When the CAN signal is reconnected, both counters start counting down. Once both counters are below 127 again, the device will go back into the Error Active state again. 

For example, to see if you device is reconnected, you can monitor the  transmit error counter. If the counter starts counting down, you can consider your device reconnected and begin communicating with it again. For some applications, this may be more useful that monitoring the communication state. 


Not Helpful