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
How Can I Program a Host Adapter to Control I2C Devices with Better Timing?
Rena Ayeras

Image by Gerd Altmann from Pixabay

Question from the Customer:

We have been using your products for years, and now we are setting up a new application. The Microchip programmer that we have been using has been discontinued. Instead of looking for a new tool, we have decided to use the Aardvark I2C/SPI Host Adapter to control I2C devices, DC fan trays, and use the Beagle I2C/SPI Protocol Analyzer to monitor the traces during evaluation. We are using the Control Center Serial Software to run our XML script in Batch Mode.

To make sure this is a long-term solution, we ran stress tests and came across a problem. The sleep mode programmed for the Aardvark adapter lasts much longer than needed. For an effective stress test, this delay must be much shorter. What are your recommendations for this issue?

Also, looking at the Data Center Software transaction, we see NACK events occur - indicated with an asterisk following the address bytes. However, while analyzing the signal with an oscilloscope, there is no NACK occurrence, as shown below. Can you explain why the information displayed is different?

Response from Technical Support:

Thank you for your questions! To resolve the excessive delay, we recommend using the Aardvark Software API instead of a batch script. The address that is indicated in the Control Center Serial Software is more likely to be a frequent result in I2C transactions. Details are discussed in the following sections.

Control I2C Devices with API Software

Due to USB latency, each command executed by the Aardvark adapter takes at least a millisecond to initiate or complete. Sometimes this can be longer if the host computer does not schedule executions in a timely manner.

  • When using API i2c_write and i2c_read functions separately, each command requires a round-trip to the host computer over USB, which causes a significant delay.
  • However, when using the i2c_write_read() function, the delay is greatly reduced because this is a single command.

The write/read function is not available in the Control Center Serial Software’s Batch Mode. The function is available with the "Master Register Read" button. As the process is to be fully automated, we strongly recommend using API functions. Several functional program examples are provided, which can be used as-is or customized for your project. Of course, you can write your own API “from scratch”. For more information, refer to Section 5 API Documentation in the Aardvark I2C/SPI Host Adapter User Manual.

Here is an example of using API for faster execution:

NACK’d Addresses with I2C Devices

As implied by what you saw on your oscilloscope, NACK’d addresses shown by the Control Center Serial Software often do not indicate a problem with the transaction. An asterisk following the address indicates the address byte was NACK'd.

In certain situations, an I2C transaction may not specify the lowest 8 bits of a 10-bit slave address. In that case, the Address (Addr) column of the Control Center Serial Software view shows the incomplete addresses as 0XX, 1XX, 2XX, or 3XX, depending on the value of the first two address bits.

NACK’d data would be indicated in the Data column as bytes followed by an asterisk.

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

If you want more information, feel free to contact us with your questions, or request a demo that applies to your application.