Support Question of the Week: Reduce Read Latency when Programming SPI Devices with an SPI Host Adapter

Q: I tested our SPI SFlash with the Aardvark I2C/SPI Host Adapter and Flash Center Software.  For that test, I modified the XML file and it works. The erase time is approximately 110 seconds, which is within specifications. The read time is more than 600 seconds, which I did not expect. I checked the clock frequency and it is 8 MHz, within Aardvark specifications.

However, the current speed with the Aardvark it is very slow. I estimate the time value is about 256Mbit/8MHz=32 seconds (+Overhead).  In summary:

  • 8MHz Clock
  • Erase Time 110 seconds
  • Read time 640 seconds
  • Write time (without erase command before): some seconds

Can you advise me how to reduce READ latency from the flash?

A:  Thanks for your question! There are many factors in latency – we’ll describe that first and then go into the solutions.

The Aardvark I2C/SPI Host Adapter can operate at bitrates up to 8 MHz as the SPI master. This maximum bitrate is only achievable within each individual byte and does not extend across bytes. There are overheads and delays that decrease the overall speed of data transfer, such as the SS# (slave select) assertion for the first clock (10 - 20 us), the setup time for each byte (7 - 9 us for SPI master), and the last clock to SS# de-assertion. For more information about SPI Signaling Characteristics, refer to the Aardvark I2C/SPI Host Adapter Data Sheet section 2.4.

Extra overhead is introduced by the operating system between calls to the Aardvark software API: the spi_write call must complete before the next API call. Each time this function is called, a 2 ms round-trip latency is incurred, which is caused by the full-speed USB link between your computer and the Aardvark adapter.

Another factor is your target device may require a delay to commit the write to a specific address, as well as a delay before performing the next read for that address. The data sheet of your target device should provide the values for these delays.  The Flash Center Software also causes a delay due to the GUI overhead.

Reduce Read Latency for Aardvark SPI Host Adapter with free API Software Figure 1: Aardvark I2C/SPI Host Adapter

When you use our free API the programming will be faster: using API reduces the GUI delay. Our API comes with support for multiple operating systems (Windows, Linux, and Mac), multiple languages (C, Python, Visual Basic, and C#), and includes examples. For more information see Getting Started - Aardvark I2C/SPI Host Adapter.

If you need greater speed, we recommend using the Cheetah SPI Host Adapter. The Cheetah SPI adapter operates at higher speeds up to 40 MHz, can provide gapless shifting, and provides more control over the timing of the data that is shifted out. In addition, the Cheetah adapter uses a high-speed USB link between the adapter and the computer. As 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.

Reduce Read Latency with Faster Cheetah SPI Host Adapter and free API Software Figure 2: Cheetah SPI Host Adapter

For additional information please refer to the Cheetah datasheet for SPI Signaling CharacteristicsAPI documentation and Getting Started - Cheetah SPI Host Adapter.

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 support@totalphase.com.

Leave a Reply