What Causes the I2C Bus Lock and How Do I Fix It So I Can Program a Device?

Question from the Customer:

I am trying to use Aardvark I2C/SPI Host Adapter and the Flash Center Software to program an I2C device, but it keeps failing because the bus is locked as shown below.

View of Locked I2C Bus with Flash Center Software

What causes the I2C bus lock? What do you suggest I do to keep the bus open so I can program the I2C device?

Response from Technical Support:         

Thanks for your question! An I2C bus locks when an error occurs or a “wait period” exceeded the timeout period.  The details are provided below.

I2C Bus Error Condition

The bus error condition is a generic error that indicates a hardware issue. In this case, a bus error occurs when a START or STOP condition occurs at an illegal position in the format frame. Bus errors rarely occur. In this case, it is likely that a configuration or condition is causing the problem.

I2C Bus Locked Condition

The bus lock condition occurs when the allowed timeout period has been exceeded. In summary: transmitting an I2C packet is in progress, and the timing from when the last event was executed or received on the bus exceeds the allowed “wait” time. This wait time occurs when the SCL (serial clock) line of the bus being held low.

  • SCL may be held low for clock stretching. In this case, a slave device is forcing the master device to wait until the slave is ready to deliver or receive data. There may be some other device that is unexpectedly holding down the SCL signal.
  • If the data line is held low, then a start condition cannot be executed by the Aardvark adapter, which can also exceed the allowed timeout period.

When excessive timeout is observed, the Aardvark adapter resets its own I2C interface – no further action occurs on the bus including programming a device.

Using Control Center Serial Software

For troubleshooting and analytics, as well as programming devices, we recommend using the  Control Center Serial Software.  This tool can be used to run batch scripts for testing and save the transactions in a CSV file for analyzing the data. We have two knowledge base articles that are related to programming devices, which may be helpful for your project:

We also have a video that demonstrates programming EEPROMs:

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

If you have other questions about our host adapters or other Total Phase products, feel free to email us at sales@totalphase.com. You can also request a demo that is specific for your application.