FTDI Community

General Category => Discussion - Software => Topic started by: EEtaoin on August 15, 2021, 11:30:26 AM

Title: LibFT4222H spi slave buffer question
Post by: EEtaoin on August 15, 2021, 11:30:26 AM
Hello,

I am currently building a prototype relying the FT4222H as SPI slave, recieving data from a sensor at a high sample rate.
The chip is running in CNFMODE 0.
On the host computer (Raspberry Pi 4) I have a thread running that is just polling
Code: [Select]
FT4222_SPISlave_GetRxStatus and calls
Code: [Select]
FT4222_SPISlave_Read as soon as data is in the rxQueue, all other processing is handled in other threads.

The datasheet states that the usb entpoint buffer is 4160B large, and a maximum of 1024B can be 'allocated'  to a single usb out entpoint as two 512B buffers if I understand correctly?

After starting my programm, there is a brief moment where the chip is configured and recieving data but the thread in charge of reading the FT4222H's buffer is not yet started. During that time, I had up to 64kB accumulate in the queue, which confused me.

Now to my question: Is there another Buffer on the Host Computers side (managed by the D2XX driver or the LibFT4222) that is larger then the 4160B buffer on the FT4222H?
When I call
Code: [Select]
FT4222_SPISlave_Read, am I actually reading out data from the chip over USB?

Thank you for the help
Greetings
Title: Re: LibFT4222H spi slave buffer question
Post by: FTDI Community on August 16, 2021, 02:14:46 PM
Hello,

You are correct, the driver retrieves the data from the chip automatically and stores it in the driver buffer within the PC and so you are reading the data from this local buffer. You can check the RxStatus to see how many bytes are available in this buffer.

Best Regards, FTDI Community