FTDI Community
General Category => Discussion - Software => Topic started by: alexh on March 16, 2023, 08:06:01 PM
-
Hi,
I was wondering if I can configure the same MPSSE channel for SPI and use the remaining 4 pins on the same channel as GPIO (for chip select)?
The LibMPSSE library has a FT_WriteGPIO function, but sets an entire byte and seems to indicate you would use the entire MPSSE channel as GPIO. If it was possible, how would I set just the lower 4 bits when the other 4 lines are used for SPI?
Thanks!
-
Hello,
This can only be done when using D2xx direct and not using LibMPSSE.
When using LibMPSSE, GPIOL[0:3] can only be used as SPI chip selects.
When using LibMPSSE, there is no way to control GPIOL[0:3] as GPIO.
LibMPSSE demonstrates controlling the higher line bytes (GPIOH) while using SPI on the lower line bytes using the following functions:
FT_WriteGPIO
FT_ReadGPIO
If you want to control some of the unused lower line bytes on the same ADBUS as SPI then see AN_411 FTx232H MPSSE I2C Master Example in C (https://ftdichip.com/wp-content/uploads/2020/08/AN_411_FTx232H-MPSSE-I2C-Master-Example-in-Csharp.pdf) which demonstrates GPIO usage with MPSSE using D2xx direct (not using LibMPSSE).
This could be used as a base to understand using both SPI/GPIO in the same code.
OK this example is for I2C but the same principles apply to SPI.
Best Regards,
FTDI Community