FTDI Community

General Category => Discussion - Software => Topic started by: dpenev on December 21, 2020, 10:55:49 AM

Title: Linux: Some ports of quad chip FT4232H with d2xx other with ftdi_sio_
Post by: dpenev on December 21, 2020, 10:55:49 AM
Hello,
I don't have much experience with the FT4232H. It is quad a port device. I want to configure some of the ports as SPI, other as UART and GPIO

I have started experimenting with the SPI . In the official documentation it says that if ftd2xx and libMPSSE are used one have to remove the standard kernel modules ftdi_sio and usbserial so I did it.

My question: In Linux can I have all 4 port configured arbitrary as SPI/UART/I2C/GPIO as each port uses possibly different driver in the PC? As far as I know the driver is loaded based on the PID/VID. It is unique for the FT4232H which has 4 ports, so how this can be done? Any thought about this is welcome.

I also want to share my current (one day) experience with the libMPSSE. Unfortunately kind of negative. I have downloaded the source code for the latest libMPSSE-rev0.6 from the official FTDI web site. I was surprised to see that no provisioning for compilation under Linux. There is no Makefile for the libMPSSE. I have made a simple one which is not a big deal but then I found out it does not compile out of the box. I got "undefined type byte" at one location. After building the library I have done a simple test application which behaved strange. I was sending 8 bytes on the SPI but with the oscilloscope I was observing 7 8bit clock packets then 100us pause and finally the last 8 bit packet. The MOSI also was incorrect in the last packet.(I was sending all 0 but got two bits high at the end) Luckily I found https://www.mathworks.com/matlabcentral/answers/518039-ftdi-libmpsse-0-6-spi_readwrite-weird-behaviour-loadlibrary-calllib . Fixing that made my transfer looks OK. It looks to me FTDI have not done even a basic check of libMPSSE

I can not understand how FTDI so popular chips can have that low quality software library. Probably ftd2xx is OK and issues are only in the higher layer libMPSSE? Anyone using libMPSSE? Should I expect more issues?
Any thoughts about FTDI solution stability under Linux is welcome.

Thanks Dimitar
Title: Re: Linux: Some ports of quad chip FT4232H with d2xx other with ftdi_sio_
Post by: dpenev on December 21, 2020, 11:00:56 AM
While waiting for approval I did some more research

It seems under Linux I can "unbind" a given FT4232H port from the ftdi_sio driver so I can access it using d2xx. Like:
sudo echo -n "1-1:1.0" > /sys/bus/usb/drivers/ftdi_sio/unbind

The rest seems to be functioning fine as ttyUSBx serial devices based on ftdi_sio

Anyone to comment if this is the way to go?
 
Thank you!