i2c_set_timeout()'s docstring states that its delay is specified in APB clock cycles (not exponential).
It callsi2c_ll_set_tout() which states that the timeout is 2**tout APB clock cycles (exponential). This controls the I2C_TIME_OUT_VALUE parameter of the I2C_TO_REG register (0x0C).
The technical reference for esp32c3 states that I2C_TIME_OUT_VALUE describes the number of APB clock cycles (not exponential), in a couple of places.
Is I2C_TIME_OUT_VALUE linear or exponential? Is the technical reference correct that its linear?
If it is exponential, the docs for i2c_set_timeout() should be changed, and if its linear, the docs for i2c_ll_set_tout() should be changed.
Answers checklist.
General issue report
In https://github.com/esp-rs/esp-hal/issues/352 I have been working on delving into esp-idf's implementation of clock stretching.
i2c_set_timeout()
's docstring states that its delay is specified in APB clock cycles (not exponential).i2c_ll_set_tout()
which states that the timeout is2**tout
APB clock cycles (exponential). This controls theI2C_TIME_OUT_VALUE
parameter of theI2C_TO_REG
register (0x0C).I2C_TIME_OUT_VALUE
describes the number of APB clock cycles (not exponential), in a couple of places.Is
I2C_TIME_OUT_VALUE
linear or exponential? Is the technical reference correct that its linear?If it is exponential, the docs for
i2c_set_timeout()
should be changed, and if its linear, the docs fori2c_ll_set_tout()
should be changed.