I can't get an I2C TCA9548a Multiplexer to recognize Nicle Sense MEs

Hello,

I’m having an issue getting a Multiplexer to work. It’s a SparkFun Qwiic Mux Breakout, 8 channel (TCA9548a) multiplexer. I have it hooked up to two Nicla Sense MEs (acting as slaves) and connected via the multiplexer to an Asset Tracker w/samd51 (acting as master), all connected with qwiic cables.

I’m using a I2C scan program to test for connected I2C devices.

I’m able to talk with the Nicla Sense MEs individually without the Multiplexer, but with the Multiplexer hooked up the addresses for the Nicla Sense MEs do not show up. The address of the Multiplexer itself does show up.

I’m using Arduino IDE 2.0.3 to program it and observe it over a com port.

Any idea what this could be? Why can’t I see the Niclas through the Muliplexer?

Thanks for any help!

…John

Here are Links to the components I’m using:

SparkFun Qwiic Mux Breakout - 8 Channel (TCA9548A)

https://www.sparkfun.com/products/16784

Nicla Sense ME

https://www.sparkfun.com/products/19727

MicroMod Asset Tracker Carrier Board

https://learn.sparkfun.com/tutorials/mi … 1661097805

SparkFun MicroMod SAMD51 Processor

https://www.sparkfun.com/products/16791 … 1661097805

Are you sending instructions to the mux to switch ports?

Hello,

Yes. I’ve used this same code before. Well, it was not very solid. It would recognize the existence of one of the Niclas and intermittently recognize the other. I changed the Niclas and hardware configuration, and now it’s not recognizing either. It’s as if something is flaky. I have my doubts it’s the program, but I might be wrong.

This is the C++ code I use to activate a channel. The _multiplexerAddress is 0x70

void multiplexerActivateChannel(uint8_t channel=7)
{  
  Wire.beginTransmission(_multiplexerAddress);
  Wire.write(1 << channel);
  Wire.endTransmission();
}

I can post all of the code…

Here it is:

// --------------------------------------
// i2c_scanner
//
// Modified from https://playground.arduino.cc/Main/I2cScanner/
// --------------------------------------

#include <Wire.h>

// Set I2C bus to use: Wire, Wire1, etc.
#define WIRE Wire
uint8_t _multiplexerAddress=0x70;
uint8_t _channel = 0x7;

void multiplexerActivateChannel(uint8_t channel=7)
{  
  Wire.beginTransmission(_multiplexerAddress);
  Wire.write(1 << channel);
  Wire.endTransmission();
}

void setup() {
  WIRE.begin();

  Serial.begin(9600);
  while (!Serial)
     delay(10);
  Serial.println("\nI2C Scanner");
  multiplexerActivateChannel(_channel);
}


void loop() {
  byte error, address;
  int nDevices;

  Serial.println("Scanning...");

  nDevices = 0;
  for(address = 1; address < 127; address++ ) 
  {
    

    WIRE.beginTransmission(address); 
    error = WIRE.endTransmission();
    if (error == 0)
    {
      Serial.print("I2C device found at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.print(address,HEX);
      Serial.println("  !");

      nDevices++;
    }
    else if (error==4) 
    {
      Serial.print("Unknown error at address 0x");
      if (address<16) 
        Serial.print("0");
      Serial.println(address,HEX);
    }    
  }
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");
  else
    Serial.println("done\n");

  delay(5000);           // wait 5 seconds for next scan
  if(_channel == 0x7){
    _channel = 0x0;
  }else if(_channel == 0x0){
    _channel = 0x2;
  }
  else{
    _channel = 0x7;
  }
  Serial.println("Channel is now : " + String(_channel));
  multiplexerActivateChannel(_channel);
}

Okay, I still have this issue.

I tried an experiment. I connected my Leonardo Arduino up to the Multiplexer instead of using the Asset Tracker. I connected it to the I2C multiplexer, and ran the scan_12c program from the Leonardo as shown above and it worked fine. It detected both of the Nicla Sense MEs.

So, why would the Asset Tracker not be able to do the same?

Thanks!

…John