NI-VISA Error -1073807246 (0xBFFF0072) the Resource Is Valid but, VISA Cannot Currently Access It

Updated May 31, 2022

Reported In

Hardware

  • CompactRIO Controller
  • Serial Interface Device
  • PXI Serial Interface Module
  • C Series Serial Interface Module
  • CompactDAQ Controller
  • PXI Controller

Software

  • LabVIEW
  • Measurement & Automation Explorer (MAX)

Driver

  • NI-VISA

Issue Details

  • I am trying to communicate with my third party instrument and I get the following error when I use the VISA example VIs.
-1073807246: The resource is valid, but VISA cannot currently access it.

 
  • I get Error 37 when trying to access the device in LabVIEW:
Error 37: Device Not Found when using the Serial Compatibility VIs. How do I resolve the error? 


 

  • If I try to access the COM port from NI Measurement & Automation Explorer (MAX) by right-clicking the port and selecting Open VISA Test Panel but I get an error:
Error opening resource:
visa://NameOfVISAResource/ASRL1::INSTR

VISA: (Hex 0xBFFF0072) The resource is valid, but VISA cannot currently access it.

Test panel.jpg

  • If I try to access the COM port from VISA Interactive Control I see the port show up as unknown and with a yellow question mark icon:

Interactive Control.jpg

Solution

You can get this error both in the LabVIEW Development Environment, a built executable, from NI MAX or from VISA Interactive Control. It indicates that control of the Serial Port could not be taken.

The following are the possible causes as well as the solutions to these errors:
  • Another program has control over the serial port. Only one program can use the serial port at a time. Close other programs that may be using the serial port, such as HyperTerminal or any NI MAX VISA Test Panels. Automatically close VISA sessions in LabVIEW by navigating to Tools -> Options -> Environment and checking "Automatically close VISA sessions.".
  • Make sure Enable Console Out is not checked in the MAX System Settings.  If this is enabled, VISA will be unable to control the serial port.
    • Some devices, such as some cRIOs, have a physical DIP switch for enabling or disabling the Console Out option. Refer to your device manual if you do not see a Console Out setting in NI MAX
  • If you are running an executable built-in LabVIEW and LabVIEW is open, LabVIEW may already have control of the serial port. After using a serial VI the default behavior of LabVIEW is to not release the serial port. You can still run another VI using serial from LabVIEW, but not an executable. In order to release the serial port, you must do one of the following:
    • Close LabVIEW. Closing all the VIs that use serial VIs is not enough to release the port. By closing LabVIEW completely, you can force to halt all the sessions that have been opened by LabVIEW.
    • Use the VISA Close VI in the VISA Advanced palette.

 
  • If you lose connection to the COM port, and then re-establish the connection, the VISA resource will need to be closed and then reopened before accessing it.
  • Try modifying the COM Port Number through Windows Device Manager.
    • Windows Device Manager -> Ports (COM & LPT) -> Right-Click over the COM device -> Properties -> Port Settings -> Advanced -> COM Port Number:
Untitled.png
 
  • If you are using a serial converter or have built your own custom serial converter, ensure that you have correctly connected the serial port lines.
  • The file serpdrv is not available (only for LabVIEW 6.1 and earlier Serial Compatibility VIs).
    • When running the VI from LabVIEW, serpdrv should be located in the directory specified by libdir (usually National Instruments\LabVIEW\)
    • When using an executable built from LabVIEW, serpdrv needs to be either in the same directory as the executable or in the same directory as the run-time engine. The common directory of the run-time engine is: National Instruments\Shared\LabVIEW Run-Time
  • For executables, copy the LabVIEW.ini file (located in Program Files\National Instruments\LabVIEW 20[XX]\LabVIEW.ini) to the folder of the executable. Rename it to have the same name as the executable (name.ini) and edit the first line from [LabVIEW] to [name].
  • Check the compatibility of your operating system (OS) and NI-VISA driver. This can be found in the readme for your version of NI-VISA. If your version of NI-VISA is not compatible with your operating system, this may be causing the error and you need to upgrade your driver.  
  • This error can also occur if the COM port is not being recognized appropriately by the driver due to a driver issue. Try Force Reinstalling NI-VISA.

Additional Information

These solutions also help resolve Error 37: Device Not Found that occurs when using Serial Compatibility VIs. These VIs have been deprecated so the error is only mentioned here as a note. If receiving the same error message in NI MAX, or for additional troubleshooting steps, please refer to the article titled COM Port in MAX Shows Exclamation Point.

Finally, this issue could be caused by plugging two different devices into the same COM port sequentially. The VISA resource could be trying to reference the last device, and be still in use.