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.