Has anyone used the PCA9540 mux? I’m having problems with it and can’t figure out what’s going on. I have several sensors on my AB_i2c bus, which all work great. I need to add a sensor which has the same address as one I’m already using so went to the mux solution. The documentation seems a little different than other i2c devices in that it does not use an address for the control register. All well and good. I used “” for the i2c.read(ADDR_MUX,"",1) and I just blast out the control byte (in this case MUX_VL_CH0 = “\x04”) for the i2c.write(ADDR_MUX,MUX_VL_CH0). That works for a while and I can read the sensor on channel 0. But when I send i2c.write(ADDR_MUX,MUX_UV_CH1) it doesn’t change channel to “\x05” as it should. Any time I try to read the control register, it reports CH0 (04), even if I read it before I have sent it any channel commands and it should be reading 0. Worse, after some time running like this, the mux takes down the entire i2c bus. I know it’s the PCA9540 causing the i2c bus problem because when I pull it, everyone is happy (except me because I can’t read my sensor with the duplicate address)
All my sensors are working correctly (checked independently).
Yes I know I can use the second i2c channel, and I have just to verify that the second sensor is working correctly. I may have to resort to that for the final project. But that adds extra wires and connections which I’m trying to avoid.
So any advice from those who have used this chip, or suggestions from those who have had similar issues with other muxes would be appreciated.