Using two I2C buses on ESP8266

I am having trouble using two I2C buses on an 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.

Abbreviated code:

#include <Wire.h> // I2C Library

TwoWire Wire2; //Second I2C bus

void setup() {

  Wire.begin(A_SDA, A_SCL);
  Wire2.begin(B_SDA, B_SCL);

  // Setup Touch Sensors
  // Setup Touch Sensors


void loop() {

read_mpr121_1(A_ADDR); //Read and print touch status registers

read_mpr121_2(B1_ADDR); //Read and print touch status registers
read_mpr121_2(B2_ADDR); //Read and print touch status registers
read_mpr121_2(B3_ADDR); //Read and print touch status registers
read_mpr121_2(B4_ADDR); //Read and print touch status registers


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 which in the code above is bus B. 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.

I've been looking at the datasheet and pinouts for the ESP8266 and I don't thing that its got 2 i2c ports. its got i2C and i2S

It is also possible to use a chip such as the 4052 mux/demux to interface several I2C devices with the same address to the same I2C bus.

Here is one description.

I believe twi is just bitbanging the I2C, i'm not using the pins assigned for the hardware peripheral for either bus. Each bus works fine independently, just not at the same time.

There is no space left for additional components on the PCB so adding a mux isn't really an option and since PCBs are made already trying to solve this through software.