Modern FTDI devices include:
- FT232R (single port, clock up to 6 MHz, 3Mbps)
- FT2232D (dual port, clock up to 6 MHz)
- FT232H (single port, clock up to 30 MHz)
- FT2232H (dual port, clock up to 30 MHz)
- FT4232H (quad port, clock up to 30 MHz)
- FT230X (single port, clock up to 48 Mhz, 3Mbps)
PyFtdi currently supports the following features:
- UART/Serial USB converter, up to 12Mbps (depending on the FTDI device capability)
- Bitbang/GPIO support
- SPI master
- I2C master
- JTAG master
Python 3.5 or above is required.
- libusb, tested with 1.0.20
may still work, but are fully untested there are nowaways obsolete.
Note about previous releases
open_bitbang arguments have changed in
v0.22.0, be sure to update your code or even better use the URL variants
If you have no choice but using previous releases of software, such as
- Python (2.6+, 3.3+),
- other PyUSB backends such as the deprecated libusb-0.1, or openusb,
- PyUSB 1.0.0b1 or below,
- pyserial 2.6+ (previous versions of pyserial will NOT work)
please checkout the latest PyFTDI 0.1x series (0.13.3) which provides support for these deprecated environmement, but is no longer actively maintained.
This project is still in beta development stage.
However, PyFtdi is being forked from a closed-source software implementation that has been successfully used for over several years - including serial @ 3Mbps, spi and jtag protocols. PyFtdi is developed as an open-source solution.
- All FTDI device ports (UART, MPSSE) can be used simultaneously.
- Several FTDI adapters can be accessed simultaneously from the same Python runtime instance.
- Serial port, up to 12 Mbps. PyFtdi includes a pyserial emulation layer that
offers transparent access to the FTDI serial ports through a pyserial-
compliant API. The
serialextdirectory contains a minimal serial terminal demonstrating the use of this extension, and a dispatcher automatically selecting the serial backend (pyserial, PyFtdi), based on the serial port name.
- SPI master. For now, SPI Mode 0 (CPOL=0, CPHA=0) is the only supported mode. It should be easy to extend the SPI master to deal with less common modes. PyFtdi can be used with pyspiflash module that demonstrates how to use the FTDI SPI master with a pure-Python serial flash device driver for several common devices.
- I2C master. For now, only 7-bit address are supported.
- JTAG is under development and is not fully supported yet.
Install native dependency. The actual command to install depends on your OS and/or your distribution. Examples:
apt-get install libusb-1.0
brew install libusb
Install Python dependencies
pip3 install pyusb pip3 install pyserial pip3 install pyftdi
- "Error: No backend available"
libusb native library cannot be loaded. Try helping the dynamic loader:
<path>is the directory containing the
<path>is the directory containing the
- "Error: Access denied (insufficient permissions)"
The system may already be using the device.
On OS X 10.9+: starting with Mavericks, OS X ships with a native FTDI driver that preempts access to the FTDI device.
The driver can be unloaded this way:
sudo kextunload [-v] -bundle com.apple.driver.AppleUSBFTDI
You may want to use an alias or a tiny script such as
Please note that the system automatically reloads the driver, so it may be useful to move the kernel extension so that the system never loads it.
This error message may also be triggered whenever the communication port is already in use.
- "serial.serialutil.SerialException: Unable to open USB port"
- May be caused by a conflict with the FTDI virtual COM port (VCOM). Try uninstalling the driver. On macOS, refer to this FTDI macOs guide.
- Slow initialisation on OS X El Capitan
It may take several seconds to open or enumerate FTDI devices.
If you run libusb <= v1.0.20, be sure to read the issue with OS X 10.11+.
There are generally two ways to open a connection to an Ftdi() object. The
first method is to use the
open() methods which accept VID, PID, and serial
parameters (among others). These methods are:
The second way to open a connection is to specify connection details using a URL. The URL scheme is defined as:
- protocol: always
- vendor: the USB vendor ID of the manufacturer
- product: the USB product ID of the device
- Supported product IDs:
- Supported product aliases:
ftprefix for all aliases is also accepted, as for example
- serial: the serial number as a string
- index: an integer (not particularly useful, as it depends on the enumeration order on the USB buses)
- interface: the interface of FTDI device, starting from 1
4for 4232* devices
All parameters but the interface are optional, PyFtdi tries to find the best
match. Therefore, if you have a single FTDI device connected to your system,
ftdi:///1 should be enough.
You can also ask PyFtdi to enumerate all the compatible devices with the
URLs can be used with the same methods as above by appending
the method name such as:
PyFtdi is developed on macOS platforms (64-bit kernel), and is validated on a regular basis on Linux hosts.
See pyftdi/tests directory for GPIO examples.
See pyspiflash module for SPI examples.