Thread safety of a new I2C driver on ESP IDF v5.2

grginho
Posts: 3
Joined: Tue Nov 29, 2022 12:54 pm

Thread safety of a new I2C driver on ESP IDF v5.2

Postby grginho » Wed Apr 24, 2024 2:09 pm

Hello,

In the Documentation for the new I2C driver, it says this:
Thread Safety
The factory function i2c_new_master_bus() and i2c_new_slave_device() are guaranteed to be thread safe by the driver, which means, user can call them from different RTOS tasks without protection by extra locks. Other public I2C APIs are not thread safe. which means the user should avoid calling them from multiple tasks, if user strongly needs to call them in multiple tasks, please add extra lock.


Does this mean that only i2c_new_master_bus() and i2c_new_slave_device() are thread safe, and all other I2C functions are not thread safe?

Regards,

Dragan

owenjames
Posts: 12
Joined: Fri Sep 02, 2022 6:24 pm

Re: Thread safety of a new I2C driver on ESP IDF v5.2

Postby owenjames » Thu May 02, 2024 4:11 am

Yes, that's my understanding. I need to consider this as I want to upgrade from the legacy driver. I have been using https://github.com/ropg/i2c_manager as a thread-safe wrapper of the legacy driver.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 431 guests