Hi there: we've been running I2C stuff very happily on ESP32 for a while now. We've just switched to using ESP32S3 and find that the i2c_set_timeout() function is failing.
Checking, it seems that for a "normal" ESP32 chip the maximum I2C timeout value is 0xFFFFF x 80 MHz APB clock cycles (so about 13 milliseconds), whereas for an ESP32S3 the maximum value for I2C timeout is only 31 x 80 MHz APB clock cycles, so 0.38 nanoseconds.
Is that correct? It seems quite a dramatic change. We, maybe incorrectly, set the I2C timeout to 10 milliseconds, hoping that gives the device at the far end the maximum time to respond. I guess there's no way to achieve this with ESP32S3?
I2C timeout and ESP32 S3 version
Re: I2C timeout and ESP32 S3 version
Does anyone have any ideas on this? Must be someone else out there using I2C on an S3 and needing to set an I2C timeout value? How do you do that? Or maybe you don't and it "just works"? Any clues appreciated.
Re: I2C timeout and ESP32 S3 version
For the benefit of anyone who gets here, after a few days of conversation with an _extremely_ helpful and knowledgeable Espressif engineer, we figured out my misunderstanding, details here: https://github.com/espressif/esp-idf/issues/11397 but in summary the timeout value value passed ESP32 is a multiplier on the 80 MHz APB clock but on the ESP32S3 it is NO LONGER THAT SIMPLE, the value is instead a power of two times either the XTAL (40 MHz) or, if you have selected it, the RC network (17.5 MHz) clock period. So:
ESP32S3: timeout = 2^x * (1/40000000)
...which is how they can get away with having a 5-bit timeout register. The technical reference manual and ESP-IDF documentation don't really make this switcheroo clear, be warned!
ESP32S3: timeout = 2^x * (1/40000000)
...which is how they can get away with having a 5-bit timeout register. The technical reference manual and ESP-IDF documentation don't really make this switcheroo clear, be warned!
Re: I2C timeout and ESP32 S3 version
Hi, Did you get your I2C timeout issue solved? using the i2C_set_timeout(),
I have been trying to get my communications working but facing similar issues you faced. I have been trying to communicate to a Sensirion Sensor, after reading the 1st data after reboot i have been getting Only TIMEOUT ERROR on the ESP32 S3. By any chance do you have any suggestions to solve this state?
Thanks in advance
I have been trying to get my communications working but facing similar issues you faced. I have been trying to communicate to a Sensirion Sensor, after reading the 1st data after reboot i have been getting Only TIMEOUT ERROR on the ESP32 S3. By any chance do you have any suggestions to solve this state?
Thanks in advance
Re: I2C timeout and ESP32 S3 version
For me the issue was just that the value one passes to the i2c_set_timeout() function needs to be calculated differently for the ESP32x3 chips: it is no longer a simple millisecond value, it is 2^SCLK_period.
For example, if the 40 MHz crystal is chosen as SCLK then you have 2^(x * 25) ns, where x can be a maximum value of 22, so for instance the largest timeout value is 2^(22 * 25) ns = 104.9ms.
For example, if the 40 MHz crystal is chosen as SCLK then you have 2^(x * 25) ns, where x can be a maximum value of 22, so for instance the largest timeout value is 2^(22 * 25) ns = 104.9ms.
Who is online
Users browsing this forum: No registered users and 121 guests