PublishQueueAsyncRK used with FRAM with other i2c devices on same bus


I’m using the PublishQueueAsyncRK Lib with a FRAM, so it use i2c to read/write data into the Fram.
Wondering if I add other i2c devices (like i2c lipo gauge, i2c led driver) on the same i2c bus, would they interfer?

As the PublishQueueAsyncRK is async and using threads, all i2c read or write on the Fram could occure at another time when calling the function. If i’m using other function that use the i2c bus anywhere else in the code (for the other i2c device) is it possible that it could corrupt the read or write messages done by PublishQueueAsyncRK in the FRAM ?

Or this is handled directly in the Wire Library ?

Sorry for this noob question but wondering how i2c bus priority is handled as 2 function using i2c can theoretically run in the same time especially if one is used in a thread.

Thanks in advance

It is possible for it to work properly, as the MB85RC256V-FRAM-RK library used for the FRAM uses Wire.lock()/Wire.unlock() surrounding all operations.

However, not all libraries do this, so if the other libraries you use do not you’ll have to surround their requests with Wire.lock() and Wire.unlock() so that the background thread in PublishQueueAsyncRK won’t access the I2C bus at the same time as your using I2C in the application thread.

You can often do this from your application code, and not have to modify the library itself.



Will check my used Libs and also modify the one i’m building for the KTD 2037 to ensure all I2c access are using Wire.lock and unlock.



This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.