Labview Interface for Arduino and Digilent LINX Error 5003: A Timeout Occurred

Updated Jun 20, 2023

Reported In

Software

  • LabVIEW
  • Third Party Add-Ons

Other

  • Arduino
  • LabVIEW Interface for Arduino (LIFA)
  • Digilent LINX

Issue Details

  • I have a VI that uses the LabVIEW Interface for Arduino toolkit. Why does it generate the following error when I run my application?
Error 5003 occurred at LabVIEW Interface for LabVIEW Interface for Arduino.lvlib:Analog Read Pin.vi. A timeout occurred while trying to read from the Arduino.
  • I have a VI that uses the Digilent LINX interface to control Arduino through LabVIEW. It seems to work fine at first, then all of a sudden I start seeing error 5003.
Error 5003 occurred at: Open Serial.vi>> Initialize.vi>> Initialize Device.vi>> Synchronize.vi

Please make sure that the LINX firmware is loaded on the device (Tools>>MakerHub>>LINX>>Firmware Wizard) that there are no other open connections to the device, then check the configuration settings and try again. 


This error is shown in the following dialog box.

 
LINX Error 5003

Solution

Error 5003 indicates that LabVIEW has lost its connection to the Arduino. A loss of connection can be caused by disconnecting the USB or serial cable while a VI is communicating with the Arduino, poor wireless signal strength when using a wireless connection such as Xbee or Bluetooth, or not downloading the LINX firmware on the Arduino when using the Diligent LINX.

Effectively, a timeout has occured when LabVIEW has not been able to read data back from the Arduino for a predefined amount of time (100 milliseconds per try for 10 retries by default).

Follow these troubleshooting steps to fix the problem:

General Troubleshooting Steps

  • Ensure that all cables are securely attached if using a wired connection or that you have adequate signal strength if using a wireless connection. The USB ports located on the back of a desktop computer generally have more stable power supply than the front panel's USB ports. You may want to use those ports if you are on a desktop computer. If you are using a laptop, make sure it is plugged in during the troubleshooting process.
  • Check to make sure you have the correct baud rate and COM port specified for your Arduino board in order to properly define the communication protocol. Failure to specify the right settings may result in this error.
  • Make sure that no other open programs are also attempting to communicate with the Arduino. For example, having the Arduino Integrated Development Environment (IDE) open may reserve the Arduino resource, resulting in Error 5003 when LabVIEW tries to access the COM port.
  • You can try to open a built-in example program that interacts with the same I/O pins to see if you still get Error 5003. This will ensure the Arduino is actually capable of communicating with your computer.

LabVIEW Interface for Arduino (LIFA)

  • Every program that uses the LabVIEW Interface for Arduino (LIFA) Toolkit should begin with the Init command and end with the Close command. Ensure that you avoid the use of LabVIEW's Abort button as much as possible. When you abort a task, your code will not have a chance to run the Close VI. The next time you run your code, the Arduino will start up in an unknown state that could result in Error 5003. You may need to restart the board and re-load the LIFA firmware to correct this.
  • You can manually change the timeout time or the number of timeout retries by modifying the Time Out and Max Retries input terminals of the Send Receive function. Having a longer timeout value or a higher number of attempts (retries) may establish communication with your device.

Digilent LINX for LabVIEW

  • Make sure that the LINX firmware has been downloaded on your Arduino. For installing the firmware, open your VI then go to Tools>>MarkerHub>>LINX>>Firmware Wizard. Follow the instructions of the Firmware Wizard to configure and complete the installation on Arduino.
  • When programming with LINX in LabVIEW always begin with the Open.vi and finish the communication with Arduino using the Close.vi

Additional Information

Note: The package LabVIEW Interface for Arduino (LIFA) has been replaced with LINX. It is highly recommended to migrate to LINX as there will be no further development for LIFA. See How To Download Digilent LINX For LabVIEW? for more information.