11-17-2015 07:54 AM
I'm trying to use the FTDI D2XX driver with the NI cRIO-6063 device.
I've installed the 1.3.6 ARMv7 hard-float library from here http://www.ftdichip.com/Drivers/D2XX.htm and followed the instructions here http://www.ftdichip.com/Support/Documents/InstallGuides.htm
so I have:
/usr/local/lib/libftd2xx.so
I've then called the ftdi FT_ListDevices function (which I'm familiar with using in LV on Windows) with the library path above.
However, I get the error 'LabVIEW: Failed to load shared library libftd2ss.so...ensure the library is present on your system...'.
I'm confident I don't have a typo or anything. Does anyone know what the problem is please?
Solved! Go to Solution.
11-17-2015 08:19 AM - edited 11-17-2015 08:38 AM
I see the file is listed in the RT dependencies folder with the warning that it has been deleted/renamed/moved so it knows it should be looking for it. From the files view, I see that it is looking in the correct place.
However if I add a call to /usr/lib/local/libvisa.so such that it is in the dependency tree it complains in the same way but then does load the library at run time, so this looks like a red herring.
If I ssh into the cRIO and type the commands below then I see that the library is there:
ldconfig -p | grep d2 libftd2xx.so (libc6,hard-float) => /usr/local/lib/libftd2xx.so
11-17-2015 08:59 AM
Actually the NI Linux ARM modules should use -mfpu=vfpv3 -mfloat-abi=softfp as gcc options, so your hard FPU selection is most likely a problem here.
As for the rest this driver likely makes use of libusb so this should probably be installed too. Also check about gcc versions used for the driver. Depending on that there might be issues with the C runtime library version used.
11-17-2015 09:12 AM - edited 11-17-2015 09:13 AM
Thanks for the quick, accurate response roflk.
I checked the actual binary, and it appears to indeed use libusb.
11-17-2015 10:04 AM
Great thank you rolfk. I installed the Arm v5 version of the library and the error has gone away. A couple of the functions are now working eg FT_ListDevices.
I'm now going to try and install libusb, hopefully that will help make the rest of it work.
Thanks,
Martin
06-23-2016 05:58 AM
@MartinMcD wrote:...hopefully that will help make the rest of it work.
Hi Martin,
How did things go with this? We are hoping to use an sbRIO to interface with custom hardware via an FTDI USB.
Thanks,
-- James
06-23-2016 06:41 AM
Here is the how-to guide I put together for myself from the information everyone gave me, it may be useful. I can reliably run FTDI USB devices on the cRIO using this approach.
Thanks,
Martin
Enable the secure shell in NI Max
Install the usbutils package which includes lsusb and is useful for seeing what devices are connected
https://wiki.debian.org/HowToIdentifyADevice/USB
opkg update opkg install usbutils lsusb -v |
Transfer it to a home directory (using WinSCP) on the cRIO and unpack it using the Putty interface
gunzip libftd2xx-arm-v5-sf-1.3.6.tgz <ret> tar –xvf libftd2xx-arm-v5-sf-1.3.6.tar <ret |
Follow the installation instructions in /release/readme.txt. Summarised:
cd build cp libftd2xx.* /usr/local/lib chmod 0755 /usr/local/lib/libftd2xx.so.1.3.6 ln -sf /usr/local/lib/libftd2xx.so.1.3.6 /usr/local/lib/libftd2xx.so |
Install the libusb library, required by libftd2xx
opkg update opkg install libusb-1.0-0 opkg install libusb-1.0-dev (if require dev tools) |
The Linux kernel will load the VCP kernel each time the device is attached and this driver blocks the D2XX driver. A udev rule needs to be created and stored in a file /etc/udev/rules.d/10-local.rules or similar. An example file to unbind the VCP driver for any usb device with a manufacturer name of myCompany is:
SUBSYSTEM=="usb",ATTRS{manufacturer}=="myCompany",RUN+="/bin/sh -c 'echo $kernel > /sys/bus/usb/drivers/ftdi_sio/unbind'" |
When the udev rule is changed the rules can be reloaded to avoid having to restart the system. At the command line type:
udevadm control --reload-rules |
We then created a new version of the D2XX LabVIEW library which references the Linux .so file rather than the Windows .dll file, this is used in the LabVIEW code deployed to the cRIO.
There is also an open-source library available as an alternative to the FTDI D2XX libray, called libftdi but I've not used it.
06-23-2016 09:04 AM
Thanks for the thorough writeup, MartinMcD.
A few points of clarification:
Follow the installation instructions in /release/readme.txt. Summarised:
This should technically also include the command "ldconfig", this is handled in the later step where libusb is installed (opkg will do this for us). Also, traditionally, the unversioned .so symlink points to the symlink created by the "ldconfig" command (ldconfig will symlink libftdi2xx.so.$MAJ to libftdi2xx.so.1.3.6, libftdi2xx.so should link to the symlink created by ldconfig). What you are doing will work, I'm simply noting that it's not the normal way to handle things. Finally, /usr/local/lib won't work in 2013, just a heads-up that /usr/lib should be used instead.
03-17-2022 10:43 PM - edited 03-17-2022 10:57 PM
Does the recent version of NI Linux RT 21.3 still require manual installation of FTDI D2XX?
My cRIO immediately detect USB to RS-485 converter with FTDI D2XX chip but VISA functions has delay with this USB device.
I'm not sure whether this is USB driver problem or not.
* results of 'dmesg' after plugging the USB device:
[13923.873991] usb 1-7: new high-speed USB device number 4 using xhci_hcd
[13924.062878] ftdi_sio 1-7:1.0: FTDI USB Serial Device converter detected
[13924.062927] usb 1-7: Detected FT232H
[13924.064382] usb 1-7: FTDI USB Serial Device converter now attached to ttyUSB0
03-18-2022 04:00 AM
You mix and match two pretty different things here by attaching to this post. This thread really is about the libFTD2XX library. This is a shared library that gives you an API to access various FTDI chips on a functional level. Useful if you want to make use of the MPSSE based I2C, SPI or other special interface modes. To access this API you then use the Call Library Node to interface to the functions in that shared library.
What you see is the automatic detection of the FTDI adapter as an USB Serial Device. Linux can recognize FTDI chips and nowadays by default installs them as such a device. To use this device you simply use the VISA functions in LabVIEW. That's ENTIRELY different to the original posters intentions.
It is not clear to me where you still have problems. If you want to use the actual FTD2XX driver, then you have to disable the automatic serial port detection. If you just want to communicate to a device connected to the FTDI adapter as a normal serial device, then you simply need to start to use VISA functions in LabVIEW.