Author Topic: FT232H Sustained SPI Performance  (Read 2630 times)

0 Members and 1 Guest are viewing this topic.

Offline sandeepzgkTopic starter

  • Newbie
  • Posts: 1
  • Country: us
FT232H Sustained SPI Performance
« on: November 19, 2020, 10:25:29 pm »
Background

I am using FT232H to communicate with my peripheral using the libMPSSE provided by FTDI. I am aware of the INFRA_SLEEP(2) issue with SPI_ToggleCS() function. My peripheral requires me to send in a CS toggle right after each 24-bits of data being sent to it. I have 40 such words of 24-bits that needs to be sent to the peripheral. I require to update the 40 words at a rate of 4KHz, which means I need to send 40x24-bit words every 0.25 milliseconds. This implies:

  • I need to toggle the CS pin 40 times every 0.25ms => 160/ms => 160,000 toggle/second.
  • I need to send 40x24-bit data every 0.25ms => 960bits/0.25ms => 3840bits/ms => 3.84 Mbits/second.
3.84 MHz (SPI) is the theoretical sustained minimum requirement for my use case. Since 1Mbit/sec => 1MHz in SPI and the theoretical max of FT232H is 30MHz, I need about 12% of the limits of FT232H. I technically don't need sustained 3.84 Mhz, I can zoom at 30Mhz, sleep for 0.25ms (up to), and then go at 30Mhz, is this not possible with FT232H?

Implementation

In order to overcome the SPI_ToggleCS()'s sleep issues, I have packed the data efficiently to FT_Channel_Write directly. All the commands are right, I inspected the FT_Channel_Write calls and captured the transactions to effectively come up with what to send to FT_Channel_Write. This part works. My pack size to FT_Channel_Write is 40x writes, which includes 24bits of payload and 40 CS toggles in that. Then my main loop sleeps for 0.250ms before waking up and sending the next payload.

Problem

After sending roughly 3150 K-bits of data via SPI no matter how fast or slow I send it, the FT232H seems to stall (no further data is sent till restarting my code). I have sent in different packet sizes, different delays, and a lot of combinations but. This seems to be the magical number I am hitting. 3135K to 3157 K-bits. Maybe there is some variance from testing.

Questions

  • What could be the issue here?
  • Is there a buffer size limit I should be aware of? (I did pour over the datasheet and couldn't find anything around this number)
  • What approaches would you suggest that I take to try to debug and find the root cause of this issue?
« Last Edit: November 19, 2020, 10:27:52 pm by sandeepzgk »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: au
Re: FT232H Sustained SPI Performance
« Reply #1 on: November 20, 2020, 01:39:10 am »

  • What could be the issue here?
  • Is there a buffer size limit I should be aware of? (I did pour over the datasheet and couldn't find anything around this number)
  • What approaches would you suggest that I take to try to debug and find the root cause of this issue?

An apparent  buffer limit issue of that size, is likely to be PC-Side, so you could try varying the packet size & counts to see if that number moves at all ?
You could also adjust the SPI clock and see if that changes the ceiling ?

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->