I'm trying to use TCA9548A (and actually have 2 i've tested because of this issue) and I just can't tell what I'm doing wrong.
I will start with the basic TCA tester sketch that can be found online:
#include "Wire.h"
#define TCAADDR 0x77
void tcaselect(uint8_t i) {
if (i > 7) return;
Wire.beginTransmission(TCAADDR);
Wire.write(1 << i);
Wire.endTransmission();
}
// standard Arduino setup()
void setup()
{
while (!Serial);
delay(1000);
Wire.begin();
Serial.begin(115200);
Serial.println("\nTCAScanner 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++) {
if (addr == TCAADDR) continue;
Wire.beginTransmission(addr);
if (!Wire.endTransmission()) {
Serial.print("Found I2C 0x"); Serial.println(addr,HEX);
}
}
}
Serial.println("\ndone");
}
void loop()
{
}
This simple code should check what I2C addresses are found on each port of the TCA multiplexer, but when I run it the Serial monitor finds 3 addresses on each port when there is literally nothing connected!
TCAScanner ready!
TCA Port #0
Found I2C 0x60
Found I2C 0x6A
TCA Port #1
Found I2C 0x60
Found I2C 0x6A
TCA Port #2
Found I2C 0x60
Found I2C 0x6A
TCA Port #3
Found I2C 0x60
Found I2C 0x6A
TCA Port #4
Found I2C 0x60
Found I2C 0x6A
TCA Port #5
Found I2C 0x60
Found I2C 0x6A
TCA Port #6
Found I2C 0x60
Found I2C 0x6A
TCA Port #7
Found I2C 0x60
Found I2C 0x6A
done
Why is it finding 2 addresses on the ports that have nothing connected to them?
Am I missing something fundamental here?
Any help is appreciated as when I connect I2C components to the Multiplexer it is not working correctly, so I figured I would start back from the basics, but clearly I don't have that figured out yet.
Oh one more thing to note; when I add an I2C component to the I2C bus connected to the Arduino this is also found by the ports (all 8 of them) during the multiplexer test for some reason.
Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project See About the Installation & Troubleshooting category.
I seem to remember that there was another topic recently where similar symptoms were described; maybe a search on the forum or a google will reveal it.
I dont have any I2C components connected to TCA9548A.
For the TCA itself Adafruit doesnt specify requiring any on their installation guide, and every other circuit ive seen working doesnt have any between the TCA and Arduino.
Are we saying I need one on the TCA to Arduino I2c bus?
That would be correct. If your device is on the Arduino side of the multiplexer, then it will always be seen during the I2C scan regardless of the multiplexer settings.
So it appears that without components on the TCA it is working correctly; maybe now i need to figure out why it doesnt when components are connected to it.
So when I connect a sensor to the TCA, say port 2 and run the Multiplexer tester script, the address of that sensor also appears on all ports again even though it's only connected to 1 port.
In addition there is 0x0 now appeared for who knows what reason.
Here is the results:
TCAScanner ready!
TCA Port #0
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #1
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #2
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #3
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #4
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #5
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #6
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
TCA Port #7
Found I2C 0x0
Found I2C 0x5A
Found I2C 0x60
Found I2C 0x6A
done
Here is the exact circuit diagram:
I'm using a MLX with an integrated I2C board that does not need pull up resistors; when I connect it directly to the Arduino, it functions correctly.
I put some pull-up resistors on the sensor wiring (4K7) and now the address for this sensor is missing and only the 0x0 appears.
TCAScanner ready!
TCA Port #0
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #1
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #2
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #3
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #4
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #5
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #6
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
TCA Port #7
Found I2C 0x0
Found I2C 0x60
Found I2C 0x6A
done