FTDI Community

General Category => Discussion - Software => Topic started by: fhsakaci on February 29, 2024, 12:11:55 PM

Title: FT_Read method for SPI communication
Post by: fhsakaci on February 29, 2024, 12:11:55 PM
Hello, I want to set up SPI communication on a Linux Jetson kit using the FT4232H chip with Bit-Bang. First, I installed the necessary structure, and I can send data properly via SPI using FT_Write. However, I encounter errors when reading incoming data using FT_Read. Also, the reading process takes a long time when I clear the FIFO each time with FT_Purge. What would be the best method for reading data over SPI? How can I read the MISO pin accurately at each rising edge of the clock signal for SPI?





Title: Re: FT_Read method for SPI communication
Post by: FTDI Community on February 29, 2024, 02:06:05 PM
Hi,

We don't have any references for doing SPI communication using Bit-Bang. I would recommend that you use the MPSSE for SPI communication instead.   

To use I2C/SPI as a master (no slave functionality), see AN_135 MPSSE Basics and our existing MPSSE Example projects:
 
MPSSE Examples (https://ftdichip.com/software-examples/mpsse-projects/)
 
There are two options to use I2C/SPI modes with the MPSSE engine:
 
a.   Use LibMPSSE libraries. Example code is provided with the download. Source code is also provided.
b.   Use D2XX drivers direct. Example code is shown at I2C / SPI. AN_108 Command Processor For MPSSE and MCU Host Bus Emulation Modes provides the necessary information.
 
Option b is the best option to use the D2XX drivers direct (no dependency on libMPSSE library).

Also please also note, SPI modes 1 and 3 are not supported with our MPSSE engine.
So please check that your SPI device doesn’t work with these modes.

You can find all the referenced documentation above, here (https://ftdichip.com/document/application-notes)