TCA9548A Doesn't work as expected

Hi everyone. I have TCA9548A I2C Mux connected to an Arduino UNO R3 board and there are 2 I2C Oled LCD 64X128 connected to the I2C Mux. When I run the I2C porta scanner code on it, and the LCDs are connected to ports 0 ~ 5, It can't find any connected device, but when I connect them to ports 6 or 7, It shows the LCD's address on all ports (0x3C).

Can someone please help me about it? Does the Mux module braked out or am I doing something wrong?

/**
   TCA9548 I2CScanner.pde -- I2C bus scanner for Arduino

   Based on code c. 2009, Tod E. Kurt, http://todbot.com/blog/

*/

#include "Wire.h"

#define TCAADDR 0x70

void tcaselect(uint8_t i) {
  if (i > 7) return;

  Wire.beginTransmission(TCAADDR);
  Wire.write(1 << i);
  Wire.endTransmission();
}


// standard Arduino setup()
void setup()
{
  Wire.begin();
  Serial.begin(9600);
  Serial.println("\nTCA9548A Scanner ready!");

  for (uint8_t t = 0; t < 8; t++) {
    tcaselect(t);
    Serial.print("TCA Port #"); Serial.println(t);

    for (uint8_t addr = 0; addr <= 127; addr++) {
      
      // Don't report on the TCA9548A itself!
      if (addr == TCAADDR) continue;

      // See whether a device is on this address
      Wire.beginTransmission(addr);

      // See if something acknowledged the transmission
      int response = Wire.endTransmission();
      if (response == 0) {
        Serial.print("Found I2C 0x");  Serial.println(addr, HEX);
      }
    }

    // Slow the loop scanner down a bit
    delay(1000);
  }
  Serial.println("\nScan completed.");
}

void loop()
{
}

The output when I connect the LCDs to ports 0~5:

TCA Port #0
TCA Port #1
TCA Port #2
TCA Port #3
TCA Port #4
TCA Port #5
TCA Port #6
TCA Port #7

Scan completed.

The output when I connect LCD(s) to one or both of the 6 and 7 ports:

TCA9548A Scanner ready!
TCA Port #0
Found I2C 0x3C
TCA Port #1
Found I2C 0x3C
TCA Port #2
Found I2C 0x3C
TCA Port #3
Found I2C 0x3C
TCA Port #4
Found I2C 0x3C
TCA Port #5
Found I2C 0x3C
TCA Port #6
Found I2C 0x3C
TCA Port #7
Found I2C 0x3C

Scan completed.

P.s: PIN A0~A2 on the Mux module are connected to the GND (Also tested without connecting them). I've tested the code with and without pull-up resistors, but nothing changes in the results.

You need pull-ups on both sides of the MUX, the connection to UNO and the connection to OLED

1 Like

Thanks for your reply, I already did that but it didn't and the result was the same.

The best thing you can do at this point is post an annotated schematic showing exactly how you have wired it showing all connections, power, ground and power sources. Also include links to technical information on each of the hardware devices.

Of course we all know what those are. But perhaps to save each of us checking you could provide links to the data sheets?

Thank you all for replying to my question, I ordered a new module and tested it even without pull-up resistors and address pins connected, and it works fine. I think there was a problem with the previous module, it was not broken but it was faulty for some reason.

For future reference, here is the datasheet:

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