I2C communication using FTDI FT4232H
The FT4232H from FTDI is a versatile chip that can act as 4 UART ports, 4 serial communication ports (I2C, SPI or JTAG) or up to 32 digital I/O lines.
The code described here is a code to use port 0 of this chip as I2C controller.
FTDI does not supply code for I2C communication, all they give is an application note for connecting I2C serial EEPROM using this chip and their own D2xx library which is not open source.
This code uses libftdi which is a free implementation of all FTDI functions for FT4232H or FT2232 chips.
libftdi is available in most Linux distributions. This library can be used on MS-Windows too, so theoreticaly one could compile this code for MS-Windows system. I do not have access to MS-Windows system so I could not check it. If someone compiles the code for MS-Windows, I would be happy to receive it and include a link to it from this page (with reference to the author of course).
The code described here contains two command line utilities:
- i2csend - send bytes over i2c bus
- i2cget - receive bytes over i2c bus
Sending bytes 0x07 0xaa 0x55 to address 0x20:
# i2csend 0x20 0x07 0xaa 0x55
Receiving to bytes from address 0x20:
# i2cget 0x20 2
Note that both commands must be run as root, this is a requirement of libftdi.
Compiling the code:
Before compiling the code, install libftdi development files. On Debian based Linux distributions (Debian, Ubuntu, Linux mint), this is done by the command: sudo apt-get install libftdi-dev
For more information on compiling and using the code, refer to the README file in the code.
This code is distributed under GPL version 3.0 and above. The license itself is given in the file COPYING distributed with the source.
For downloading the code: i2cftdi.tar.gz