ESP-IDF 5.3.2 I2C driver: Unexpected behavior in sync/async usage.

psparodi
Posts: 4
Joined: Wed Oct 02, 2024 11:17 am

ESP-IDF 5.3.2 I2C driver: Unexpected behavior in sync/async usage.

Postby psparodi » Thu Mar 20, 2025 4:38 pm

Hello, in addition to the inquiry I made some time ago regarding the use of the new I2C driver (IDF version 5.3.2), I am trying to implement an I2C bus with two devices: one operating synchronously (accelerometer) and the other asynchronously (OLED display). Based on the related documentation, this should be possible by assigning a callback to the device I want to function asynchronously, while initializing the other device without a callback so that the driver uses it synchronously.

The first issue I encountered is that the function i2c_master_transmit_receive() always returns ESP_OK, regardless of whether the device is physically removed from the bus to intentionally cause an error. Additionally, when using this function with the device initialized for synchronous operation, it should block (to wait for the device's response), but it does not, forcing me to implement a waiting loop after calling the function.

The last point I would like more information about is the warning issued by the driver during initialization, stating that it is experimental and may cause errors when attempting to send a large amount of data in asynchronous mode. How much data is considered a large amount?

In summary, is the scheme I am trying to implement—where one device uses the bus synchronously and the other asynchronously—possible? Are the issues I mentioned known bugs in the new driver?

Thank you very much.

Who is online

Users browsing this forum: ChatGPT-User and 2 guests