U8G2 OLED Multiplexing issue

Sorry, I am here seeking for help of my OLED multiplexing issue. I tried to use this TCA9548A (from DFRobot) to multiplex two u8g2 supported OLEDs but failed (nothing showed). However, I tested each OLED successfully (by connecting it to ESP32 i2c bus). So things must go to the multiplexing problem, may I know what's happening? Thanks a lot.

#include <Arduino.h>
#include <U8g2lib.h>
#include <Wire.h>
//#include <DFRobot_I2C_Multiplexer.h>

#define TCA9548A 0x70
void tselect(uint8_t i) {
  if (i > 7) return;
  Wire.beginTransmission(TCA9548A);
  Wire.write(1 << i);
  Wire.endTransmission();
}

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(/* rotation=*/U8G2_R0, /* reset=*/U8X8_PIN_NONE);

//Create an I2C Multiplexer object, the address of I2C Multiplexer is 0X70*/
//DFRobot_I2C_Multiplexer I2CMulti(&Wire, 0x70);

void setup(void) {
  Serial.begin(115200);
  for (int i = 0; i <= 7; i++) {
    tselect(i);
    u8g2.setI2CAddress(0x3C);
    u8g2.begin();
    Wire.begin();
  }
  tselect(0);
  //u8g2.begin();
  u8g2.clearBuffer();                   // clear the internal memory
  u8g2.setFont(u8g2_font_t0_17b_tr);    // choose a suitable font
  u8g2.drawStr(0, 10, "Hello World!");  // write something to the internal memory
  u8g2.sendBuffer();                    // transfer internal memory to the display
  delay(1000);
}

Nothing is reported from the Arduino "Output" Section.

The code you posted won't compile, you can't upload it to the Arduino. The loop() function is missing.

Perhaps your loop() function is empty?

Try this:

void setup(void) {
  Serial.begin(115200);
  Wire.begin();
  u8g2.setI2CAddress(0x3C);
  u8g2.begin();
  for (int i = 0; i <= 7; i++) {
    tselect(i);
    u8g2.clearBuffer();                   // clear the internal memory
    u8g2.setFont(u8g2_font_t0_17b_tr);    // choose a suitable font
    u8g2.drawStr(0, 10, "Hello World!");  // write something to the internal memory
    u8g2.sendBuffer();                    // transfer internal memory to the display
    delay(1000);
  }
}

Thanks for your answer. I included loop() function actually and modify the codes with your suggestions however things still are not working. Anyway, I will continue looking for the solutions.

U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(/*rotation=*/U8G2_R0, /*reset=*/U8X8_PIN_NONE, 22, 21); 

I think I got the solution. I shall add SCL and SDA pin config in the u8g2 object constructor for ESP32.