I2C SPI USB CAN eSPI Cable Testing View All Videos Quick Start Guides Software Downloads App Notes White Papers User Manuals Knowledge Base Sales Support About Us
Products Blog Sales Support Contact Search
Support Question of the Week: How do I use an SPI Host Adapter to Overcome Latency on the USB link?
Rena

Q: For my application, I’d like to conduct real-time audio testing. I am using the AardvarkTM I2C/SPI Host Adapter along with the Python API to deliver SPI data in packets of 8 bytes. I am trying send my 8-byte packet out every 1ms, but it appears the minimum overhead of the aa_spi_write() call is 2ms. I have not found a limitation in my Python script - the loop is much faster than 2ms. However, when I look at the transaction on a logic analyzer, there is a significant amount of time between the packets, as shown below.

Viewing SPI Packet Timing with Latency on a Logic Analyzer. Figure 1: SPI Packet Timing with Latency

About the test I’m running:

Data is sent in packets. Each 8-bit chunk is one block of compressed audio, and I need to send them at 1ms intervals. I cannot send the entire array of data in one huge transaction.  How can I make this run faster - overcome latency?

Thanks for the question! The USB interface on the AardvarkTM I2C/SPI Host Adapter is full-speed USB (12 Mbps) – on the USB, it sends one SOF every millisecond. However, the CheetahTM SPI Host Adapter has a high-speed USB interface – on the USB link, it sends one SOF every 125s.  The Aardvark adapter is a great multi-purpose tool, but for the speed requirements of your SPI application, we recommend using the Cheetah SPI Host Adapter. There are factors that cause latency in data transfer, which are described below.  For more information about timing and USB links, please refer to our knowledge base article USB Background.

The Aardvark I2C/SPI Host Adapter is a powerful and economical general-purpose host adapter for I2C and SPI circuits Figure 1: Aardvark I2C/SPI Host Adapter

The Aardvark I2C/SPI Host Adapter is a powerful and economical general-purpose I2C/SPI host adapter The Aardvark I2C/SPI host adapter uses a full-speed USB link between the adapter and the computer, operates bitrates up to 8 MHz as an SPI master and 4 MHz as an SPI slave. The maximum bitrates are achievable within each individual byte - they do not extend across bytes.

There are various overheads and delays that decrease the overall speed of data transfer, such as the SS# assertion to first clock (10 - 20 us), the setup time for each byte (7 - 9 us for SPI masters), and the last clock to SS# deassertion. The Aardvark adapter also has 2ms round-trip latency, which is caused by the full-speed USB link between your computer and the Aardvark adapter.  For additional information about  SPI Signaling Characteristics, please refer to section 2.4 of the Aardvark manual.

 Cheetah SPI Host Adapter is a high-speed master SPI host adapter that provides faster communication and response Figure 1: Cheetah SPI Host Adapter

The Cheetah SPI Host Adapter uses a high-speed USB link between the adapter and the computer. Since the Cheetah adapter uses a high-speed USB link, the USB latency is reduced from 2ms to about 250us when using the Cheetah adapter's synchronous interface. The Cheetah host adapter also has an asynchronous interface that may provide additional speed for your application.

The Cheetah SPI Host Adapter operates at higher speeds up to 50 MHz, can provide gapless shifting, and provides more control over the timing of the data that is shifted out.  For additional information about the Cheetah SPI signaling characteristics, please refer to section 2.5 of the Cheetah Host Adapter User Manual. For more information, please refer to the following documents:

Aardvark Adapter User Manual

Cheetah Host Adapter User Manual

USB Background

Total Phase Products

Product Selector Guide

We hope this answers your question. If you have other questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com or submit a request for technical support.