Skip to content
Juan Gonzalez-Gomez edited this page Feb 15, 2018 · 95 revisions

LibFTDI Cross-builder

Libftdi is an open source library to talk to FTDI chips: FT232BM, FT245BM, FT2232C, FT2232D, FT245R, FT232H and FT230X including the popular bitbang mode. The library is linked with your program in userspace, no kernel driver required.

We will compiled it for differente archs (Windows machines, Linux 32 bits, Ubuntu Phone...) from a Linux computer. The package libftdi-arch-x.tar.gz will be generated (as well as a program example for testing)

Cross-compiling the libusb library

It has been tested on a Ubuntu 15.10 machine

Follow these steps:

  • Install the git client (if you already do not have it):
$ sudo apt-get install git
$ git clone https://github.com/FPGAwars/libftdi-cross-builder.git
  • Enter into the libusb-cross-builder directory:
$ cd libftdi-cross-builder
  • Depending on the target platform, execute the corresponding build script:
Platform Execute
Windows 64 bits $ bash build-windows_x86_64.sh
Windows 32 bits $ bash build-windows_i386.sh
Linux 32 bits $ bash build-linux_i686.sh
Ubuntu phone $ bash build-ubuntu-phone_armhf.sh

After some time, the packages libftdi-ARCH-x.tar.gz, libftdi-ARCH-x.zip and find_all-example-ARCH-x.zip will be generated in the package directory (where ARCH is the target platform and x the version)

Cleaning

Execute the same build script with the target clean for deleting all the packages and intermediate files generated. Example:

$ bash build-windows_x86_64.sh clean

Testing on Windows 7

We will test the find_all.exe program. Copy it to your home in your windows 7 machine

Running find_all.exe the first time

Execute the find_all.exe program (Download this package). If there are no FTDI devices connected, you should get the following message:

C:\Users\smith>find_all
Number of FTDI devices found: 0

If the icestick board (or any other ftdi device) is connected and the program is execute again, the following message will be obtained:

C:\Users\smith>find_all
Number of FTDI devices found: 1
Checking device: 0
ftdi_usb_get_strings failed: -4 (libusb_open() failed)

We need to install the drivers in order to make it work correctly

Driver installation

(NOTE: I have not been able to make it work on a QEMU virtual machine. Only on real Window 7 machines)

Connect the icestick board and open de device manager. Under the category "universal serial bus controllers" you should see two new controllers: USB serial converter A and B

In the "devices and printers" panel you should see the new device "Lattice FTUSB Interface cable"

If you click on the device, you will see all their properties

We will use Zadig, an opensource Windows application that installs generic USB drivers easily. You can download the executable from this link. Execute Zadig

Initially no devices are listed. Select the option menu and click on the "List all devices"

In this example, 11 devices have been found. Now click on the driver bar and select "Lattice FTUSB Interface cable (Interface 0)"

In the main windows the new device Lattice FTUSB Interface cable (Interface 0) is shown

Click on the arrows to select the libusbK driver

and click on the Replace Driver button. The driver installation will start

After some time, the installation is finished. Press the close button

The Zadig main windows should be like this:

Go to the device manager to check that the driver is working. There USB converter A should have disappear and the new Lattice FTUSB Interface Cable (Interface 0) is a new device under the category libusbK USB devices

NOTE: Windows 10 + USB 3.0: If find_all does not work after installing to interface 0, try to install to interface 1 as well. However please note that installing to interface 1 breaks libftdi/libusb on some systems

Running find_all.exe program

Now it is time to test again the find_all.exe program (Download this package). Open the command line interface an execute it. You should see the following output:

C:\Users\smith>find_all
Number of FTDI devices found: 1
Checking device: 0
Manufacturer: Lattice. Description: Lattice FTUSB Interface Cable

Your system is ready for executing program that uses the libftdi library. For example the icestorm toolchain for working with FPGAs on the icestick board

More tests

  • [2016-Feb-26]: Pablo Clemente and GianLuca Pugliesse tested it on Windows 7 64-bits. Ok. Thanks!
  • [2016-Feb-27]: Carlos díaz tested it on Windows 10, 64-bits. Thanks!

  • [2016-Feb-28]: Cristóbal Bueno tested it on Windows 8.1 64-bits. Thanks!

  • [2016-March-05]: Eladio Delgado tested it on windows 7 - 64 bits. Thanks!

  • [2016-March-23]: Sebastián Gallardo tested it on Windows 7 - 32 bits. Thanks!

Testing on ubuntu phone

  • Executing find_all program when the Icezum Alambra is connected:

  • The information shown is:

Author

  • Juan González-Gómez (Obijuan)

Credits

  • Pablo Clemente (Paclema). Testing. Thanks!
  • GianLuca Publiesse. Testing. Thanks!
  • Carlos Díaz. Testing. Thanks!
  • Cristóbal bueno. Testing. Thanks!
  • Eladio Delgado. Testing. Thanks!
  • Sebastián Gallardo. Testing. Thanks!

License

Licensed under Creative Commons Attribution-ShareAlike 4.0 International License

Links