Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Tigers
#70728 I am having trouble using two I2C buses on the ESP8266, it seems the Wire library implementation prevents using two I2C buses. I have five MPR121 touch sense controllers which only allow selection of four I2C addresses hence the need for two buses.

The issue is the last bus to be started is the only one which may be read or written.

When I query the MPR121s on bus A and bus B the values for both buses will only return the bus which was started last. So if I start bus A first and bus B second I will only get values on bus B when I try reading both buses. If I swap the order of setup and start bus B first and bus A second then the values returned for queries on bus A and bus B will only be the values on bus A. I confirmed the hardware output is on the last started bus only using a scope.

Thanks for the help.
User avatar
By brunofr
#71059 Hi
You may use the SlowSoftWire library to setup your 2nd I2C bus in addition to the I2C bus managed by the Wire library. The Wire library would default to using the I2C controled by pins D1/D2 while you would setup a 2nd I2C bus using pins D5/D6 with SlowSoftWire Wire2 = SlowSoftWire(D5, D6, true); .
I am currentlry testing I2C in slave mode with SlowSoftWire library.
Hope this helps