FX3 SPI and I2C Latency

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
AnMc_4628076
Level 1
Level 1
5 replies posted 5 questions asked 5 sign-ins

I am currently using a USB2 High-Speed FTDI chip for USB-to-SPI conversion. 

I am trying to get the lowest possible time to send multiple, small datagrams over SPI.  I am not too concerned about the time to actually send the bits (so far at least, maybe withFX3 that's a new constraint!) which is only a handful of microseconds.

To test the speeds, I perform a loop to send 6 bytes back-to-back (Windows 10, 6-core Xeon, C#) 100 times then calculate the average time with the following psuedocode:

 

1. Start stopwatch

2. Chip select assertion

3. Read+Write 6 bytes over SPI bus at 10 MHz clock

4. Chip select de-assertion 

5. Repeat #2 through #4 until 100 cycles are reached 

6. Stop Stopwatch

7. Calculate average total time per SPI transaction (= Elapsed time of stopwatch divided by 100)

 

This yields about 700 microseconds per SPI transaction (on average) when the computer is doing nothing but running this loop, so it's probably a best-case situation.

 

Here's my questions: 

1. If I use GPIO-controlled slave-selects with FX3, what is an estimate of the total cycle time I would see per SPI transaction (assume 6 bytes transfer, 10MHz clock)...can that 700 microseconds number drop substantially?

2. Would this be done with DMA mode or register mode?  If the number could be dropped low enough I could test with some dummy writes and an oscilloscope with an FX3 eval to ballpark it.

This isn't a legally-binding number :).

I'm just trying to estimate if it would be worth testing something with an FX3 eval board for example.  If that 700 microseconds could come down to below something like 150 microseconds I would consider spending time on it, but if you think it's not going to get that low I would pass and live with what I have.

Thanks.

0 Likes
1 Solution

Hi,

According to the SPI timing sequence in the FX3 datasheet , time taken for SPI transfers from the bridge IC to the SPI slave is ~ 12us. But we have not explicitly tested the timings like this. You can try to test the latency using  UsbSpiDmaMode or UsbSpiRegMode firmware examples in the FX3 SDK.

Best Regards,

AliAsgar

View solution in original post

0 Likes
3 Replies
AliAsgar
Moderator
Moderator
Moderator
1000 replies posted 250 solutions authored 750 replies posted

Hi,

Is the roundtrip time which you have mentioned, from host to SPI slave or from the chip to the SPI slave.

Also you can try both the SPI reg mode and SPI DMA mode firmware in the FX3 SDK . But as there are just 6 bytes, so reg mode is preferred for short transfers.

Best Regards,

AliAsgar

0 Likes

AliAsgar,

Thanks for the response.  The roundtrip time I mention is "host-to-host" so the data flow is:

Time = 0: Software on Host Computer is triggered to send data to USB-to-SPI bridge IC (over USB2 High Speed protocol)

Time = ?: USB-to-SPI Bridge IC sends data to/receives data from Slave IC (SPI protocol)

Time = ?: USB-to-SPI Bridge IC sends data back to Host Computer (USB2 High Speed protocol)

Time = 700 microseconds: Host Computer has processed data and verified it is correct

Thanks.

 

 

0 Likes

Hi,

According to the SPI timing sequence in the FX3 datasheet , time taken for SPI transfers from the bridge IC to the SPI slave is ~ 12us. But we have not explicitly tested the timings like this. You can try to test the latency using  UsbSpiDmaMode or UsbSpiRegMode firmware examples in the FX3 SDK.

Best Regards,

AliAsgar

0 Likes