Check new ftdi-embedded-hal project in the ftdi-rs organization for the up-to-date implementation of FTDI MPSSE embedded HAL.
Implementation of the embedded-hal traits for FTDI chips supporting Multi Protocol Synchronous Serial Engine (MPSSE).
This implementation of embedded-hal
allows you to work with various SPI/I2C devices over USB. If your Linux board has accessible I2C or SPI pins, then it is possible to connect I2C/SPI devices directly. For this purpose linux-embedded-hal
implementation of embedded-hal
traits can be used. However normal Linux workstations usually do not have direct access to SPI/I2C, but have enough USB ports. In this case ftdi-embedded-hal
can be used. For instance, this may come particularly handy for playing with various I2C/SPI devices, e.g. trying them out or working on driver development.
Currently support for GPIO/SPI/I2C on FT232H and FT2232H chips has been implemented. There are many development boards and modules for FTDI chips. The following modules have been used for development and testing:
- FT232H development module UM232H
- FT232H development module CJMCU-232H
- FT2232H development module
Brief list of features supported out of the box:
- supported devices: FT232H, FT2232H
- MPSSE mode is supported, no pure bit-banging support
- SPI/I2C/GPIO support
- SPI
- MODE0, MODE2
- 500kHz, 1MHz, 3MHz, 5MHz
- I2C bus
- 100kHz, 400kHz
- GPIO
- output mode only
- SPI
Limitations:
- FTDI device is selected by USB PID/VID, so only the first connected device will be handled
- no gpio input support
- i2c/spi are mutually exclusive due to h/w circuitry (not sure if anything can be done from s/w side to support both simultaneously)
- GPIO functionality is disabled for ADBUS[0..3] and BDBUS[0..4] pins (SK/DI/DO/CS)
- no support for SPI MODE1 and MODE3 (not sure if anything can be done from s/w side as this is a limitation for FTDI chips)
- not enough flexibility in clock selection
- fixed list of suppported SPI/I2C frequencies
- clock is selected once for the first bus instance and should be the same for all the other bus instances, runtime changes are not supported
- tests can be run only when FTDI devices are connected
TODO:
- more cleanup and refactoring in terms of idiomatic Rust
- suppport several connected FTDI devices with the same USB PID/VID
- enable ADBUS[0..3] and BDBUS[0..3] pins as GPIO pins as well, just keep track of selected functionality, it is already done anyway to disable i2c and spi at the same time
- add gpio input support
- add support for FT4232H
- more flexibility in clock configuration (?)
- add more I2C/SPI/GPIO examples/tests, e.g. 74HC595, MCP3008, PCF8574, and more
Projects
ftdi
- Rust wrapper over libftdi1 library for FTDI devicesembedded-hal
- Hardware Abstraction Layer (HAL) for embedded systemslinux-embedded-hal
- implementation of theembedded-hal
traits for Linux devices- device driver crates that use
embedded-hal
interface
Data sheets for FTDI chips and development modules:
Application notes provided by FTDI: