Why won't this work?

I have a Redboard Qwiic, Qwiic mux, and one SEN-16476 (Qwiic) pressure sensor connected to P0 on the mux. I have disabled the I2C pull-ups on the sensor. I have the Qwiic connector from the redboard connected to Main on the mux. The output that I get on the serial monitor is nan PSI. Any ideas?

Thanks Eric

#include <SparkFun_I2C_Mux_Arduino_Library.h>

#include <Wire.h>

#include <SparkFun_MicroPressure.h>

SparkFun_MicroPressure mpr;

/*

Basic control and commands for the PCA9548A/TCA9548A I2C multiplexer

*/

#define MUX_ADDR 0x70 //7-bit unshifted default I2C Address

//Enables a specific port number

void enableMuxPort(byte portNumber)

{

if (portNumber > 7) portNumber = 7;

//Read the current mux settings

Wire.requestFrom(MUX_ADDR, 1);

if (!Wire.available()) return; //Error

byte settings = Wire.read();

//Set the wanted bit to enable the port

settings |= (1 << portNumber);

//Write the updated settings

Wire.beginTransmission(MUX_ADDR);

Wire.write(settings);

Wire.endTransmission();

}

//Disables a specific port number

void disableMuxPort(byte portNumber)

{

if (portNumber > 7) portNumber = 7;

//Read the current mux settings

Wire.requestFrom(MUX_ADDR, 1);

if (!Wire.available()) return; //Error

byte settings = Wire.read();

//Clear the wanted bit to disable the port

settings &= ~(1 << portNumber);

//Write the updated settings

Wire.beginTransmission(MUX_ADDR);

Wire.write(settings);

Wire.endTransmission();

}

void setup() {

Serial.begin(115200);

if(!mpr.begin()) {

Serial.println(“Cant Connect”);

}

for (byte x = 0 ; x <= 7; x++){

disableMuxPort(x);

}

}

void loop() {

enableMuxPort(byte (0));

Serial.print(mpr.readPressure(),4);

Serial.println(" PSI");

disableMuxPort(byte (0));

delay(500);

}

Thanks for replying. Yes, I have tried it both ways. I was assured by the moderator that it is necessary to have the mux pullups enabled, and any sensor pullups disabled.

Since cutting the pullup resistors is micro surgery. Can the cuts be verified with and ohm meter without damaging the sensor board?

So while connected, I checked the voltage on the 3 I2C pads on the back of the sensor, and they are still all 3.3 volts. So I think that I am unclear how to cut the traces. If this is a representation of them: O-O-O, I cut the spaces between the pads deeply, which seems to be what the schematic suggests. Is this correct? If not could you please explain with some sort of diagram. Could it be that because of characteristics of the circuit that I should get 3.3 volts anyway with the traces cut? I would check resistance across the pads unenergized if I thought it wouldn’t damage the sensor board, could it?. I can’t imagine that I didn’t cut deep enough, but maybe.

With the board unplugged, measure with a ohm meter between the center pad and each outer pad. You should see a high resistance or an open circuit. If the trace isn’t fully cut you will see a short circuit.

Resistance is in the megohms, so it must be the code or the mux. The mux control code is pretty much straight from the example guide. I have run a lone sensor successfully without the mux. I must be missing something.

Since the pullups are indeed cut, wouldn’t the voltage on SCL and SDA be a square wave form ; so measuring their voltages with a DVM should be a duty cycle, and the average voltage should be less than the measured 3.3 volts, maybe half that?

That being said, Mr Russel, would you please look at my code above? I have had no success with the mux and I am running out of ideas.

Thanks

Eric

I got it to work, was as simple as one line of code.

Thanks everyone.