FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  


Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support

New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: LibFT4222H spi slave buffer question  (Read 1276 times)


  • Newbie
  • *
  • Posts: 1
    • View Profile
LibFT4222H spi slave buffer question
« on: August 15, 2021, 11:30:26 AM »


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

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 756
    • View Profile
Re: LibFT4222H spi slave buffer question
« Reply #1 on: August 16, 2021, 02:14:46 PM »


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