I2c Master & I2c Slave sample not working when interfaced via PCA 9548A I2c Mux

Dear Friends

I am trying to run a simple scenario of interfacing an I2C Master to I2c slave via PCA948a i2c mux. I have interafced I2c master to a PCS9548 i2c pin SDA and SCL while I have I2C Slave interfaced to SDA0 and SCL0 pin of 9548a. I am using nick gammon’s Master slave example for this experiment. I have tested this by directly interfacing 2 MEGA 2560 (one acting as Master and Other acting as slave) and this setup runs perfectly well giving me the channel outputs.

I also have also separately tested MEGA 2560 interfacing with PCA 9548A with i2c scanner example. I get the return reply of the address as 0x70 also. But when I try interfacing a slave via 9548 i donot get any reply.

I am simply adding 9548 function as explained in the below tindie link to i2c master.


Following is the simple function I am using to interface 9548a.

void selectI2CChannels(uint8_t channels)

Can anybody suggest me or help me where am I going wrong in this? Or I would appreciate if anybody could point me to any example of interfacing i2c master /slave using PC9548a.
I am attaching the modified master slave ino file for your ready reference.

looking forward to a prompt response. Thanking you in anticipation.

Best Regards

I2c_master_nick.ino (1.26 KB)

I2c_slave_nick.ino (1.29 KB)

FYI :-- I have shorted A0, A1, A2 pins to GND. and hence my PCa 9548A address is 0x70 only.

  Wire.begin ();

that part should read


In the slave code, the command variable must be declared volatile.


The channel register value is a bit field. If you set it to 0 you deactivate all I2C buses. If you want to select bus 0, write a value of 1.