LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cRIO Linux FTDI D2XX

Solved!
Go to solution

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?

0 Kudos
Message 1 of 10
(5,815 Views)

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
0 Kudos
Message 2 of 10
(5,809 Views)
Solution
Accepted by topic author MartinMcD

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.

Rolf Kalbermatter
My Blog
Message 3 of 10
(5,787 Views)

Thanks for the quick, accurate response roflk.

 

I checked the actual binary, and it appears to indeed use libusb.

0 Kudos
Message 4 of 10
(5,771 Views)

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

0 Kudos
Message 5 of 10
(5,751 Views)

@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

0 Kudos
Message 6 of 10
(5,433 Views)

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

 

  1. Enable the secure shell in NI Max

    1. http://digital.ni.com/public.nsf/allkb/9822A3A39B1D0CBB86257C55006B962A
  2. Use Putty to open a terminal interface on the cRIO, log in as 'admin' with a blank password.
  3. Use WinSCP for secure FTP file transfer to the device
  4. 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
  5. Plug in the USB device and check if it has been recognised using the command 'dmesg'.
    1. http://digital.ni.com/public.nsf/allkb/94A534CA79FF8A7E86257C670068ED2B
  6. Install the FTDI D2XX driver. We need the build for the Arm v5 with soft float.
  7. Download the driver onto the PC from here http://www.ftdichip.com/Drivers/D2XX/Linux/libftd2xx-arm-v5-sf-1.3.6.tgz
  8. 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
  9. 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
  10. 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)
  11. 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'"
  12. 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
  13. 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.

  14. There is also an open-source library available as an alternative to the FTDI D2XX libray, called libftdi but I've not used it.

Message 7 of 10
(5,431 Views)

Thanks for the thorough writeup, MartinMcD.

 

A few points of clarification:

 

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

 

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.

0 Kudos
Message 8 of 10
(5,418 Views)

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

0 Kudos
Message 9 of 10
(2,334 Views)

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.

 

 

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 10
(2,323 Views)