Error -1073807339 Timeout Expired Before Operation Completed

Updated Feb 20, 2024

Reported In

Software

  • LabVIEW
  • Measurement & Automation Explorer (MAX)

Driver

  • NI-VISA

Operating System

  • Windows

Issue Details

When I try to communicate with my instrument in LabVIEW or in VISA Test Panels, I get the following error: 
 

Error -1073807339 occurred at VISA <function name>.vi
Possible reason(s):
VISA:  (Hex 0xBFFF0015) Timeout expired before operation completed.

 

image.png

 

Picture2.png

Solution

This error occurs when NI-VISA expects to receive a message or response from a device, but that message is not received within the timeout period, or at all. This error is commonly caused by improper physical connection, incorrect communication settings, or using commands that the device does not recognize. This document will walk you through the process of troubleshooting each component of your system.
 

Test the Physical Connection

  1. Make sure that the cable is properly connected to your device.
  2. If possible, try a different cable.
  3. Depending on your device, follow the instructions in the appropriate article below to ensure that your communication settings are correct:
  1. Ensure that you are using the correct termination characters for your device. 
  2. (If using a serial device) Perform a Serial Loopback Test. This can highlight problems in the serial port, the cable, or the software generating the messages without having to connect to third party hardware.
  3. If using a PXI/PXIe Serial card try changing it to a different chassis slot.


Run a Shipping Example

If you have confirmed that your physical connection and communication settings are configured properly, try running a shipping example. A shipping example will perform basic inputs and outputs to your device, and may help narrow down the specific functions or commands that are causing the error.
 
  • For GPIB examples, open LabVIEW and navigate to the Help >> Find Examples >> Hardware Input and Output >> GPIB >> GPIB with VISA Functions vi.
  • For serial examples, open LabVIEW and navigate to the Help >> Find Examples >> Hardware Input and Output >> Serial >> Simple Serial.vi.
    • There is also an example specific to RS-485 communication available at Help >> Find Examples >> Hardware Input and Output >> Serial >> RS-485 Transceiver Control.vi.
 

Troubleshoot Your LabVIEW Application

  • Try to narrow down your program to the smallest possible section of code that consistently reproduces the error. Compare this section to a shipping example, or try modifying a shipping example to perform the same task.
    • Note: Be sure to save a copy of the shipping example before modifying.
  • Refer to your device’s user manual to ensure that you are using the correct command syntax.
  • You can configure indicators in LabVIEW to display hidden characters such as linefeed (\n), carriage return (\r), or tab (\t). Use this functionality to ensure that your messages and termination characters match the device’s user manual.
  • Try putting Termination Character Enabled (TermChar En) in your code to see the issue can be solved or not.
  • Refer to the manual for your device to see if a response is expected for the particular command you are sending.
  • If you are using older instrumentation, try implementing a Wait function between VISA Write and Read. Older instrumentation may not respond immediately to commands written to the port, causing a large delay between VISA Write and VISA Read commands. Applications designed to interface with this type of instrumentation should anticipate this delay.
    • Alternatively, if the response time from the device is not consistent, you can add code to handle the timeout error. You may want to retry the VISA Read operation a certain number of times before throwing the error to the user.
  • Manually designate a timeout using the VISA Set Timeout Property. For more information, refer to Configuring Timeout for VISA Sessions
  • Take an I/O Trace. This will give you a record of all commands sent between NI-VISA and your device.
  • The manufacturer of your device may provide a LabVIEW instrument driver. Check the Instrument Driver Network (IDNet), or refer to the manufacturer’s website.
  • Confirm your device is not being reserved by any other LabVIEW or Third Party Program.