Are multiple I2C instances safe?

I have a few peripherals connected on an I2C bus. In my source code I instantiate one i2c instance, and pass it to the peripheral specific functions for them to perform their operations.

However, I have one peripheral that uses a library that instantiates its own instance of an I2C object. Due to the nature of this library, it would require an extensive modification of the library to support passing an I2C object via composition.

This leads me to my question. Would two I2C instances using the same sda and scl pins bring about any problems? My intuition is telling me yes, but I would prefer to get away with the current setup.

Any help would be appreciated!

I have run multiple I2C devices on up to two different I2C buses with no problem. It should work fine unless you has a device addressing conflict on the same I2C bus.


1 Like

Thanks for the response, that’s good to hear!