FT232RL Breakout Board

Now that I’ve upgraded my computer, I no longer have a Parallel port which renders my Altera FPGA Compatible Programmer obsolete. Instead of buying a $300 USB-Blaster from Altera, I’m developing a much cheaper solution…

In my next post I’m going to show a technique I’ve come up with to configure the Cyclone II FPGA using a FT232RL USB to UART Bridge. The breakout board costs $15, while the part itself costs $4 which is a much more agreeable solution for my wallet.

Before I can get into the specifics of the FPGA configuration, I need to show you how to install the proper drivers to play with the FT232RL. Presently FTDI recommends using the libFTDI driver which appears to be maintained by the Intra2Net company. The library is released under the GNU Lesser General Public License so you can use it in free and proprietary programs. Currently only version 0.17-1 of libFTDI is available from the Ubuntu Software center, which has a few too many bugs for my liking. This lead me to another learning experience in my linux adventures: I had to learn how to compile the driver from its source code.

I should mention quickly that I’m going to be writing code using Python. I’m using the eclipse editor with the Pydev IDE.

In order to use the libFTDI driver in Python you will need to run the SWIG tool to generate the ‘glue code’ to call the libFTDI’s C/C++ functions. I’ll cover this aspect of the install in this tutorial as well.

Here are the steps to get going with the latest version of libFTDI:

1. Download the latest tarball from their website: libftdi-0.18.tar.gz
http://www.intra2net.com/en/developer/libftdi/download.php

2. Extract the files into another directory named libftdi.

3. Using Ubuntu Software Center install the following:
SWIG (To generate the Python ‘glue code’)

Python Headers (Dependencies for using SWIG)

libusb-dev (Need these development (header) files to compile the libFTDI drivers)

4. We need to make a minor modification to the source code to allow us to actually read data from the device using Python due to a bug:
In the file: /libftdi/libftdi-0.18/bindings/ftdi.i

We need to insert a single line:
%pointer_functions(unsigned int, uintp);
(Check the screenshot)

5. Now we go through the install process.
In a terminal window, navigate to the folder where you extracted the tarball files:
For me: ~/Downloads/libftdi/libftdi-0.18$ and type the following statement:
./configure --enable-python-binding
(Note that the --enable-python-binding option will automatically tell the installer to run SWIG and generate our python glue-code.)
next type:
make

then:
sudo make install

6. Now, we have one last step in order to make the device available to non-root users. We’ll be adding a rule to the udev:
Create a new file in the /etc/udev/rules.d folder called 60-FTDIRT232R-usb.rules

Enter the following text into the file:
ATTR{idVendor}=="0403", ATTR{idProduct}=="6001", MODE="0666"

(I’m pretty sure you will need root to create this file)

Now you should be good to go. Try running python in interactive mode and type import ftdi to make sure the install and pathing is correct.

In the next post I’ll show you how to actually use this library to do work.