Support Question of the Week: When does the Aardvark I2C/SPI Host Adapter Enable Clock Stretching?

We are using the AardvarkTM I2C SPI Host Adapter as an I2C slave to test a master I2C port on another device. It appears the Aardvark adapter is using clock stretch while it is configured as a slave. Can you tell us what causes clock stretching - when we should expect to see that feature?

The Aardvark I2C/SPI Host Adapter is a powerful and economical general-purpose host adapter for I2C and SPI circuits Figure 1: Aardvark I2C/SPI Host Adapter

 

Thanks for your question! The Aardvark I2C/SPI Host Adapter supports the I2C clock stretch feature, which is always enabled; clock stretch cannot be disabled. Clock stretching holding the SCL (serial clock) line low can occur when the Aardvark adapter is functioning as a master device or a slave device.

 

On an I2C bus, either master or slave devices can hold SCL low to generate clock stretch. Figure 2: I2C Bus

 

Per the I2C specification, both master devices and slave devices can initiate clock stretch. Following are the two reasons for clock stretch to occur:

  1. In I2C communication, the master devices controls the clock speed, and will perform a clock stretch when it needs to slow down the clock.
  2. Although the master device controls the clock speed, a slave device can perform clock stretching when it needs more time to store a received byte or to prepare another byte to be transmitted.  A slave device can also perform a clock stretch after receiving and acknowledging a byte. This feature allows the slave to force the master into a wait state until the slave is ready for the next byte transfer. For example, a slave microprocessor may need additional time to process an interrupt, get the data and place it in its transmission register; an EEPROM, however, does not have such internal functions, and does not need clock stretching.

When the Aardvark adapter is configured to slave mode, it can generate clock stretch when it needs to perform and finish its internal function. For example, the Aardvark adapter can generate clock stretch when it needs more time to store a received byte or prepare another byte to be transmitted. The Aardvark adapter can generate the clock stretch before restart or before start, depending on the configuration, system setup and traffic.

For additional information about clock stretching, please refer to section 3.1.9  of the I2C specification. For more information about the Aardvark I2C Host Adapter and other Total Phase products, please refer to the following documents:

 Aardvark Adapter User Manual
Total Phase Products
Product Selector Guide

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 submit a request for technical support.

Leave a Reply