Note: This document only applies to versions of NI software released prior to NI Linux Device Drivers. For new designs, NI recommends using
NI Linux Device Drivers to take advantage of repository-based installation and more frequent updates to support.
Verify the following configuration settings in the process of troubleshooting your system:
- Do you have the NI-VISA driver installed?
You must have the NI-VISA driver installed in addition to the driver specific to your device (that is, the NI-488.2 driver if you are using a National Instruments GPIB controller) for the serial communication to work.
- Is the NI-VISA driver installed in the right place?
/usr/local/vxipnp...
is the default path to the home directory of NI-VISA. Environment variable VXIPNPPATH
should point to this path or the path you specified when you perform an env
query.
- Is there a correct series of links that point to the
libvisa.so.7
hard file in the user library?
Search the path for the libvisa.so
file by performing the following query: ld_library_path libvisa.so
. The user library should include a soft link for libvisa.so
that points to another soft link. The second soft link points to the hard file of libvisa.so.7
. If this path is not correct, find the hard file of libvisa.so.7
and create a link that points to it in the user library.
If the ld_library_path libvisa.so
query does not work on your computer, locate the file using the find / -name 'libvisa.so.7' -print
command or locate libvisa.so
. Once you locate this file, create a link to it in the user library.
- Do you have permission to read and write to your serial port?
By default, only the administrator is allowed serial port access. Log on as an administrator (or root). Make sure that users have read/write access to port 0 by performing the following query: ls -l /dev/ttyS0
. You must perform the same query for all ports that you want to read or write to (for example, /dev/ttyS0
for port 1, /dev/ttyS1
for port 2, and so on). Alternatively, you can query all ports with ls -l /dev/ttyS*
. You can add permission for everyone to read and write from your serial ports by issuing chmod 666 /dev/ttyS*
The command allows everyone to read and write to all serial ports.
- Do you have permission to read the
/usr/local/natinst
and /usr/local/vxipnp
directories?
LabVIEW and the VISA driver must be able to access files in these directories. It is common to install software as root and then use it as another user. If your user permissions are sufficiently restricted, you may not be able to use VISA at all.
- Are you using the correct VISA Resource Name?
When you refer to serial ports in Linux, you should use only ASRL1::INSTR
, ASRL2::INSTR2
, and so on. COM1
, COM2,
or ttyS0
and ttyS1
are not correct.
- Are your serial ports enabled?
Run the visaconf
tool to query your resources and display all serial ports. Make sure all ports you want to use are listed as enabled by double-clicking on the resource and viewing the resource window. If a port is disabled, change it to the enabled state.
- What if I am unable to run the visaconf
tool?
This command will not work unless /usr/local/vxipnp/Linux/NIvisa
is in the users PATH. If the PATH does not exist, you must use the /usr/local/vxipnp/Linux/NIvisa/visaconf
command instead.
- What if my serial port is listed as busy?
Try creating a new VI in LabVIEW that uses the VISA Clear VI. Set the VISA resource name to the serial port that was listed as busy (that is, ASRL2::INSTR
for port 2, ASRL3::INSTR
for port 3, and so on) and run the VI a few times to clear the port. If the serial port is still busy, make sure other applications on your computer are not using it.
- What if none of my serial ports are listed?
You want to add static and then manually add the serial ports (/dev/ttyS0
, /dev/ttyS1
, and so on).
- Is your external cabling correct?
Verify that your instrument is connected to port 1, if that is the port you want to use.
- Is your software program correct?
One way to determine whether your error is caused by improperly configured serial ports or by your software program is to remove the software. Use NIvisaic
for Linux to scan all ports and find all resources. You also can write to one port and have another read from it to test its functionality. If the ports behave correctly, the problem lies within your LabVIEW program. NIvisaic
is similar to Measurement & Automation Explorer, which is available in Windows. The NIvisaic
command works only if the PATH is included (see part 6 above).
Another good way to test your serial ports is to use one of the LabVIEW examples, such as the Easy Loopback VI. You can search the Example Program Database (linked below) or use one of the LabVIEW shipping examples by selecting Help»Find Examples and typing serial
in the Search tab.