Installing pyftdi on Ubuntu 18.04 for FT232H and FT2232H boards

Why use  FT232H and FT2232H boards?

I wanted to use a FT232H board for some hardware hacking. The FTDI FTxxx family of devices and boards based on this chip is categorized as a Multi-Protocol Synchronous Serial Engine (MPSSE), which can be used to debug UART, I2C, SPI and JTAG devices.  I’ve used single-purpose devices, as well as the BusPirate, however there are limitations.

I like the BusPirate a lot. It’s fun to use and has many handy features. But it’s slow, and doesn’t support JTAG very well. The FT2xx family of chips do a much better job.

I have several boards that use this chip, including:

Others include:

I looked at some  libraries and software, but I wanted one that supported all the chips I have, including the  FT2232H-based TUMPA board. I also wanted to use python, a popular language for hardware hacking.

What’s the difference between the FT232H and FT2232H chips?

There are a few differences between FT232H and FT2232H boards.

  • The FT2232H supports two connections, so you can connect to two devices, or access two different protocols on the same target board. So you can access both SPI and I2C, or I2C and JTAG.
  • The FT232H has a 1KB Ring buffer, while the FT2232H has a 4KB buffer.
  • The FT2232H has 16 GPIO pins.

By the way, the FT4232H chip supports 4 channels, compared to the FT2232H’s 2 channels and the FT232H’s single channel. So think of the variations as a single, dual or quad version of the same MPSSE.

I also learned that the Shikra board was developed because the TUMPA had a “very high failure rate (they’d burn up easily or stop working inexplicably).” The Shikra does have a MOSFET circuit to limit current to the device.

Preparing Ubuntu so that your normal (non-root) account can install python-based software

Before we install the software, there are a few options:

  • Install it as root. That is, do everything as root. Besides a potential security risk, this can cause problems if you combine installing software using other package managers, you can get inconsistencies and conflicts.
  • Install the files into non-standard locations. This is more difficult to set up, and if you have other packages, you may have to deal with multiple versions and locations
  • Give yourself the ability to install software as a non-root, but privileged user. This is the directions I took.

Ubuntu uses the group staff as the group that can work with installed files. In particular,  the directory /usr/local/lib/python3.6/dist-packages belongs to group staff. However, members of the group staff do not have write permission. This can be fixed using

sudo chmod g+w /usr/local/lib/python3.6/dist-packages

Also, the executable directory /usr/local/bin belongs to group root. We need to change this to group staff and make it group writable:

sudo chgrp staff /usr/local/bin
sudo chmod g+w /usr/local/bin

There is another step – add yourself to group staff.

sudo addgroup $USER staff

However, before you can install the software, you have to log out and log in. Use the command groups(1) to make sure you are in the group.

I decided to use this method, because:

  • I can easily install and debug utilities without becoming root.
  • Any changes I make are easily located (and removed) because I own the files, and not root. If another package re-installs the files and erases changed I make can be located.

Warning: Python also installs files under $HOME/.local/lib so the above be aware of this.

Installing pyftdi

I started with a fairly clean version of Ubuntu. I downloaded the pyftdi source from the Github respository.  Note that the repository is likely more up-to-date. I had build errors untill I used the most recent version. The code uses python3, (you will get syntax errors if you use python 2) and you have to install the python setup tools if you haven’t already:

sudo apt-get install python3-setuptools

Now go to your repository and type the following:

python3 ./ build
python3 ./ install

That should be all you need to do. To test this, plug in the board and type

You should see the following two interfaces

Available interfaces:
ftdi://ftdi:2232:3:2a/1 (Dual RS232-HS)
ftdi://ftdi:2232:3:2a/2 (Dual RS232-HS)

If not, the board may have a different vendor or product

The way to check this is to do plug in the board,  and type the dmesg command and look for a string like this

New USB device found, idVendor=0403, idProduct=8a98

If this is the case, then you should add a new line to /etc/udev/rules.d/11-ftdi.rules

SUBSYSTEM=="usb", ATTR{idVendor}=="0403", ATTR{idProduct}=="8a98", GROUP="plugdev", MODE="0666"

The udev subsystem has to be restarted after this change:

udevadm control --reload-rules

However, to get pyftdi to work, I had to have to modify the source. One way to do this is to add the product ID into the source by modifying pyftdi/

---	2020-03-22 13:37:57.919150970 -0400
+++	2020-03-22 10:56:17.390397876 -0400
@@ -82,6 +82,7 @@
              '2232': 0x6010,
              '2232d': 0x6010,
              '2232h': 0x6010,
+             '2232h': 0x8a98,
              '4232': 0x6011,
              '4232h': 0x6011,
              '230x': 0x6015,
@@ -93,6 +94,7 @@
              'ft2232': 0x6010,
              'ft2232d': 0x6010,
              'ft2232h': 0x6010,
+             'ft2232h': 0x8a98,
              'ft4232': 0x6011,
              'ft4232h': 0x6011,
              'ft230x': 0x6015,

Then reinstall the software as above. Be aware that you might have multiple versions of the executables, and if you execute an old one, it will not work.

However, this isn’t the approved method.

A second method is to reprogram the EEPROM and modify the product ID.

A third method it to use an option added in v0.48.3: -P 0x403:0x8a98

A fourth method is to add the new product ID with an API call. But that’s only needed if you are writing your own code.






This entry was posted in Hacking, Hardware Hacking, Linux, Security and tagged , , , , , , , , , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.