I’m trying to use an FT2232H mini module as a breakout board to interface with external SPI, I2C sensors on Linux.
I found an interesting tutorial here: https://ben-gillett.medium.com/i2c-and-more-with-the-ftdi-ft2232h-mini-module-and-an-arduino-ce0982578fed but unfortunately it is for Windows (disgusting)
So I discovered that the first thing I need to do is disable the ftdio_sio module, otherwise the device only will work as USB/Serial module:
https://stackoverflow.com/questions/33649296/how-can-i-get-linux-device-with-ftdi-d2xx-driver-api
(Note: it is only needed by proprietary D2XX lib, the libFTDI ignores ftdio_sio presence)
So, instead of using the proprietary D2XX (or some equivalent to it) I realized it was better to use the libFTDI on Linux and found a nice tutorial to test it using python:
First a created the suggested rule to use the devices as normal user (assuming you already added your user to dialout group)
$ sudo vi /etc/udev/rules.d/99-libftdi.rules
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", GROUP="dialout", MODE="0660"
$ sudo udevadm trigger
Install the python library:
$ pip install pylibftdi --break-system-packages
Create a simple test script to detect if your device was recognized:
$ cat test.py
import sys, pylibftdi as ftdi
print(ftdi.Driver().list_devices())
When you run it you should see:
$ python3 test.py
[('FTDI', 'Dual RS232-HS', '')]
Some links that you could consider useful:
An open-source lib compatible with D2XX API: https://github.com/heavyii/d2xx
Using proprietary D2XX driver on Linux: https://github.com/keithlegg/FT2232H_D2XX_linux