How to increase I2C bus timeouts?
Posted: Mon Nov 06, 2023 12:39 am
Hi,
Is there any way to configure a ESP32 I2C master driver so that it can handle long SCL-low periods?
The reason I want that is quite simple: my EPS32 master device sends a "start" command to a custom proximity sensor slave device (STM32) and waits for the response. The response might take up to a couple of seconds and the slave side can hold SCL low as long as required. However, this is far too long for basic read/write I2C driver functions as they all fail with a timeout error (0x107). The maximum I2C bus timeout set with i2c_set_timeout() is as miserable as 0.82 ms (16-bit value @ 80MHz).
Also, I made a couple of ugly attempts to try get round this issue:
(a) set up I2C_NUM_0 = master, I2C_NUM_1 = slave and let them share same SDA/SCL pins. No success.
(b) switched master/slave and slave/master in a loop. No success.
PS. I"m using IDF-5.0.1
Any suggestions
Is there any way to configure a ESP32 I2C master driver so that it can handle long SCL-low periods?
The reason I want that is quite simple: my EPS32 master device sends a "start" command to a custom proximity sensor slave device (STM32) and waits for the response. The response might take up to a couple of seconds and the slave side can hold SCL low as long as required. However, this is far too long for basic read/write I2C driver functions as they all fail with a timeout error (0x107). The maximum I2C bus timeout set with i2c_set_timeout() is as miserable as 0.82 ms (16-bit value @ 80MHz).
Also, I made a couple of ugly attempts to try get round this issue:
(a) set up I2C_NUM_0 = master, I2C_NUM_1 = slave and let them share same SDA/SCL pins. No success.
(b) switched master/slave and slave/master in a loop. No success.
PS. I"m using IDF-5.0.1
Any suggestions