Programmatically Clearing a CAN, DNET or LIN Device

Updated Jan 23, 2019

Reported In

Software

  • LabVIEW

Driver

  • NI-CAN
  • NI-DNET

Issue Details

My program has crashed or aborted and my NI-CAN or NI-DNET object was not closed properly. When I try to restart my code I get error -1074388986. How can I clear my device?

Solution

Use the ncAction.vi with "Reset" constant wired into the Opcode input.

The Reset action first issues the Stop action, clears all entries from the write queue, then resets the CAN or LIN hardware. Resetting the CAN hardware sets the CAN error counters to zero, returning the CAN controller to error active state. Resetting the LIN hardware returns the interface to slave mode and resets all slave task response queue entries so that the slave task subscribes to all LIN IDs.

The reset action is propagated up to all open higher-level CAN Objects. The NI-CAN Hardware and Software Manual and Specifications  document provides more details of this VI.

 

Additional Information

The following errors may be resolved by resetting the CAN, DeviceNET or LIN device:

Error -1074388986 occurred at ...
NI-CAN:  (Hex 0xBFF62006) The object is already open in another application.  Solutions: Ensure that only one application at a time uses an object , and that you close all objects prior to exiting your application (don't use LabVIEW toolbar's Abort button).

Error -1074388969 occurred at ...
NI-CAN: (Hex 0xBFF62017) This attribute's value must be provided prior to the Open. Solutions: Set the attribute using the Config function before the Open, and do not set the attribute at any later time; Do not configure multiple CAN Objects for the same ID.