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 Use a Host Adapter for Slower I2C Devices without Timeout or Bus Lock Occurring?
Rena Ayeras

Question from the Customer:

We are using the Aardvark I2C/SPI Host Adapter and Control Center Serial Software to interact with an I2C slave device. Our challenge is the bitrate of the target device is 500 Hz, which is below the bitrate range that the Aardvark adapter supports: 1000 Hz. The details of our setup:

  • The I2C dongle (Aardvark adapter, master) interacts with the FPGA, which is a slave to the Aardvark adapter and a master to the I2C peripheral. The FPGA acts as a bridge.
  • The I2C peripheral interacts with a very slow slave device that operates at 500 Hz.

When the I2C transaction between FPGA and the slow I2C completes, we release the SCL of the Aardvark adapter and put ACK on the dongle SDA line. This is where we have a problem. We expect the Aardvark adapter to toggle the SCL and read the ACK bit. But instead, the SCL remains high – it is as though the bus is locked.

Is there a way to successfully operate at a slower speed?

Response from Technical Support:

Thank you for your question!  In I2C mode, the Aardvark I2C/SPI Host Adapter operates from 1 kHz to 800 kHz. In your case, the period that SCL is held low can be extended, which effectively slows down the bitrate. This method is available with our Aardvark Software API, which is described below. As bus locks can occur for various reasons, we also include troubleshooting tips.

Extend Timeout and Slow Down Bitrate

Note – this method is recommended because the target device operates at such a low bitrate that timeout occurs. The SCL speed of the Aardvark host is not slowed down below 1 kHz, but by extending the timeout period, the Aardvark host can successfully operate with the slower device.

The SCL line can be held low for an extended period by using the API command aa_i2c_bus_timeout. The maximum time for bus timeout is 450ms, which should work for the 500 Hz bitrate. Here is a summary of how that command works:

  • The default timeout of the Aardvark adapter is 200ms.
  • The minimum timeout value that can be set is 10ms. The maximum value is 450ms.
  • If a timeout value outside this range is passed to the API function, the timeout will be restricted.
  • The exact timeout that is set can vary based on the resolution of the timer within the Aardvark adapter.

For more information, please refer to API Documentation section the Aardvark I2C/SPI Host Adapter User Manual

Troubleshooting Bus Lock

Here is additional information about what causes bus lock and troubleshooting tips.

When a bus lock occurs, it may be caused by the interactions from the Aardvark adapter or from the target adapter.

Here is an easy way to diagnose this lock condition:

  1. Connect a scope to the SDA and SCL lines and wait for the bus lock condition to occur.
  2. When bus lock occurs, check the state of the SDA and SCL lines during the lock condition.
  3. Unplug the Aardvark adapter and see if the SDL SCL state changes.
  4. Repeat the steps 1 and 2: reconnect the Aardvark adapter, reset the test setup, and wait for the bus lock condition to occur
  5. This second round, unplug the target device and see if the SDL and SCL lines change.

This method clarifies if the Aardvark adapter or the target device is locking the bus.

Note - when bus lock occurs, the only way to unlock the bus is to disconnect and power cycle the Aardvark adapter. To prevent timeout from locking the bus, the API command aa_i2c_bus_timeout can be used to extend the timeout to 450ms, or if needed, reduce it to 10ms.

We hope this answers your question. 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.