How Can I Accelerate the API Command Functions when Communicating with I2C Bus Devices?

Question from the Customer:

I am using the Aardvark I2C/SPI Host Adapter with Aardvark Software API.

For my application, I am sending API functions aa_i2c_write and aa_i2c_read one after another, with no pause between those two commands. However, the read command follows the write command after 1ms. Is there a way I can reduce this delay for my I2C bus projects?

Response from Technical Support:

Thanks for your question! For your application, we recommend using the Promira Serial Platform. We’ll start with describing how the Aardvark adapter works, then follow up with the advantages of the Promira platform.

Aardvark Adapter Bitrates

The Aardvark adapter operates at USB Full Speed (12 Mbit/s).

The Aardvark I2C master supports 1 KHz - 800 KHz. Because of the I2C protocol requires that 9 bits are sent for every 8 bits of data, bytes cannot be sent at exactly 1/8 times the bitrate. The Aardvark adapter allows throughputs very close to the theoretical maximum byte throughput of 1/9 the bitrate. For more information about I2C bitrates, please refer to the article I2C signaling characteristics.

Timing Overhead for the Aardvark Adapter

There is a required finite time to set up a byte transmission. In addition, overhead is introduced by the operating system between calls to the Aardvark API.

The aa_i2c_write (or aa_i2c_read) call must complete before the next API call. Each time this function is called, a 2ms round-trip latency is incurred which is caused by the full-speed USB link between the computer and the Aardvark adapter.

In addition, the target device may require some time to commit the write to a specific address before performing the next read for that address. For details about such delay, please refer to the datasheet of the target device.

The internal overhead of the computer OS (operating system) may also add additional delay.

Aardvark API Functions

For the Aardvark API functions, everything is a block function that waits for the response from the device. All functions are affected by USB latency, which is 1~2ms.

Why the Promira Serial Platform Runs Faster

The Promira platform supports I2C master/slave bitrates up to 3.4 MHz. The Promira platform uses Ethernet and Ethernet over High-speed USB as its connection to the computer, which enables it to operate faster than the Aardvark adapter (which only communicates over full-speed USB). The Promira platform also provides queue functionality that allows multiple Promira Software API I2C/SPI Active commands to be queued up and shifted to the device at once. For more information about queuing, please refer to the Queue section of the Promira Serial Platform I2C/SPI Active User Manual.

Timing Factors to Consider

  • The maximum bitrates are only achievable within each individual transaction and do not extend across transactions. On rare occasion, there may be delays across the Ethernet / USB bus, including within a transaction.
  • The GUI and the OS may add delay due to internal overhead. In addition, the Promira platform has latency caused by the Ethernet / USB link between the computer and the Promira platform.
  • When using the High-speed USB connectivity, the Promira platform USB round-trip latency is reduced to 250us, which is far less than the 1-2ms latency of the Aardvark adapter.
  • Using the Ethernet connectivity can further reduce the Promira platform USB round-trip latency.
  • For additional information please refer to the AC Characteristics section of the Promira Serial Platform System User Manual

We hope this answers your question. Additional resources that you may find helpful include the following:

If you have more questions, please contact us at sales@totalphase.com. You can also request a demo that applies to your application.