Error -1073807330 on VISA Configure Serial Port

Updated Aug 1, 2023

Reported In

Software

  • LabVIEW

Driver

  • NI-VISA

Issue Details

When I run VISA Configure Serial Port.vi, I receive

Error -1073807330:
The specified state of the attribute is not valid, or is not supported as defined by the resource. 



Why do I receive this error, and how do I fix it?

Solution

This error is caused by unsupported values being passed to the hardware driver by NI-VISA. Please check your serial hardware and your device's manual to ensure that the settings being passed by NI-VISA to the underlying hardware driver match both the serial bus and the hardware specifications. This includes the write commands themselves being sent to the device as it may not follow standard serial protocols.

One common cause of this error is wiring an incorrect value to the stop bits input of the VISA Configure Serial Port.vi. You can configure the number of stop bits to be either 1, 1.5, or 2, and it may seem intuitive to simply wire in this number to the stop bits input. However, the input is an integer input and cannot take a value of 1.5 since this is a double.

The best solution for this is to right-click on the input and create a constant. This will create an enumerated ring control that will pass the correct value to the VI for you. Another method is to input the appropriate value that represents the number of stop bits into the VI. The table below shows what value should be input for each number of stop bits you desire.
 
Number of Stop BitsValue to Input
110
1.515
220

The picture below shows both methods that will work for setting the number of stop bits, along with the incorrect method of passing in a double. 

Additional Information

On Windows, the NI-VISA driver will pass any baud rate set by the user. First, a check is made to make sure that it is greater than or equal to 50 and is an integer. After this check, the value is sent to "SetCommState", a hardware driver call. From here, "GetCommState" is called and takes note of what the hardware driver reports as the active baud rate. 

If the hardware driver reports something different than the rate set by the user, it will return VI_ERROR_NSUP_ATTR_STATE (error -1073807330). In other words, if the user attempts to set the baud rate at a value that cannot be obtained by the hardware an error code will be returned.