1 Introduction
The purpose of this application note is to provide users of FTDI chips with a simple procedure to install FTDI drivers for FTDI
devicesusing Linux.
1.1Overview
FTDI has two types of drivers for all supported operating systems. These are the virtual COM port driver (VCP) and the D2XX API driver. Sincethe FTDI VCP driver is built into the Linux kernel, this document will focus on the installation of the D2XX driver.
Toensure all FTDI devices have VCP driver support, FTDI recommends installing the latest kernel release on the Linux system.In Linux,the VCP drivers will appear as /dev/ttyUSBx.
How to verify the built-in COM port:
Plugin a FTDI based design/module/cable
Opena terminal window, and enter
dmesg | grep FTDI <ret>
<ret>代表回车
[10170.987708]USB Serial support registered for FTDI USB Serial Device
[10170.987915]ftdi_sio 9-1:1.0: FTDI USB Serial Device converter detected
[10170.991172]usb9-1: FTDI USB Serial Device converter now attached to ttyUSB0
[10170.991219]ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver
InLinux, the VCP driver and D2XX driver are incompatible with eachother. When a FTDI device is plugged in, the VCP driver must be unloaded before a D2XX application can be run. Use the remove module(rmmod) command to do this:
sudo rmmod ftdi_sio <ret>
sudo rmmod usbserial <ret>
When the FTDI device is power cycled or reset the VCP driver will bereloaded.
The rmmod processmust be repeated each time this occurs. It is possibleto write a simple script that unloads the VCP driver before running the D2XX application.
2 Installing D2XX driver
Download the Linux D2XX driver from the FTDI D2XX driver web page( http://www.ftdichip.com/Drivers/D2XX.htm). The driverfiles are contained in a tar gzip file. This archive contains theD2XX driver and directory of sample code. Most Linux distributionshave utilities for extracting tar gzip archive files, such as theArchive Manager in Ubuntu. Figure 2.1 shows a screen capture showing the contents of the tar gzip archive.Click on Extract and save allthe files to your desired target directory.
Figure2.1Contents of D2XX driver archive
Asan alternative, you can use the Linux gunzip and tar–xvfcommands to extract the driver files.Open a Linux terminal window and enter
gunzip libftd2xx1.1.12.tar.gz <ret>
tar–xvf libftd2xx1.1.12.tar <ret>
Oncethe files have been extracted, change to the required architecturesubdirectory (i386 for 32 bit systems, x86_64 for 64bit systems, &arm926 for ARM v5 systems such as Raspberry Pi).
2.1LinuxShared Object and Static Library Install
All driver files are copied and linked using the Linux sudo command forroot permissions.
sudo cp /releases/build/arch/lib* /usr/local/lib <ret>
archrefers to CPU architecture: i386,x86_64,arm926
Makethefollowing symbolic links and permission modifications in/usr/local/lib:
cd /usr/local/lib <ret>
sudo ln –s libftd2xx.so.1.1.12 libftd2xx.so <ret>
sudo chmod 0755 libftd2xx.so.1.1.12 <ret>
3 Compiling and Running Sample D2xx Applications
FTDIprovides both Shared Object (.so) and Static linked (.a) D2XXlibraries. Here are the installation procedures for these libraries.
3.1Buildingand Running the Shared Object Examples
Toverify the D2XX driver install, compile and run the EEPROM readsample program. Make sure the Linux system has the gcc compilerinstalled.
cd /examples <ret>///应该是对应的文件夹位置
make –B<ret>
cd /examples/eeprom/read <ret>
Thename of the executable file is read.
Plugin the FTDI based device.Remove the VCP driver as described insection 1.1:
sudo rmmod ftdi_sio <ret>
sudo rmmod usbserial <ret>
Runthe sample application:
sudo ./read <ret>
Theread application will list the configuration descriptors of theattached FTDI device as follows:
openingport 0
ftHandle0= 0x8e89220
Signature1= 0
Signature2= -1
Version= 2
VendorId= 0x0403
ProductId= 0x6001
Manufacturer= FTDI
ManufacturerId= FT
Description= USB-Serial Converter
SerialNumber= FTG5FL9U
3.2Buildingand Running the Static Library Example
Thestatic library example is simple to run and execute:
cd /release/examples/static <ret>
rm lib* <ret> (removes any previous library built for anothertarget)
cp /usr/local/lib/libftd2xx.a . <ret>/复制
make –B<ret>
sudo ./static_link
Thisapplication will write and read 16 bytes to port 0 of any FTDI USB->UART device with a loopback connector attached:
Device0 Serial Number -FTVESNIO
Openeddevice FTVESNIO
FT_Readread 16 bytes
Closeddevice FTVESNIO