This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TCA9548A: Compatibility with Multi-register Slave Devices

Part Number: TCA9548A

Hello,

I'm using the TCA9548A multiplexer to connect to several AD7746 capacitance-to-digital transducers along with a Teensy 3.2 microcontroller. The AD7746 has 19 data registers (0-18) and I've encountered a host of problems when I try to read data from any register aside from 0 (the default one)..

For example, if I want to read from the device on channel 7, I select channel 7 and read 19 bytes (one from each register starting at register 0. However, I've noticed that this actually gives me data from the device connected to channel 0 instead. I've included an example output from my circuit below. There is only one device connected to the MUX, on channel 7. The other channels are not connected to anything. All 8 channels have 4.7k pullup resistors. The numbers after the colons in the output below are all 8-bit numbers; the printout doesn't include leading zeros on binary numbers. None of these values match either the default values for the register or the values I attempted to write to specific registers (7,9,10,11,13,14).

----------------------------------------------
EXAMPLE OUTPUT #1
----------------------------------------------
Current data from register 0 : 0
Current data from register 1 : 0
Current data from register 2 : 0
Current data from register 3 : 0
Current data from register 4 : 0
Current data from register 5 : 0
Current data from register 6 : 0
Current data from register 7 : 0
Current data from register 8 : 0
Current data from register 9 : 0
Current data from register A : 0
Current data from register B : 0
Current data from register C : 0
Current data from register D : 0
Current data from register E : 0
Current data from register F : 0
Current data from register 10 : 0
Current data from register 11 : 0
Current data from register 12 : 0
---------------------------------------------------------

However, if I use the same functions and use (1<<7) instead of 0 I get the following output. The only difference is that instead of writing 0 (to select data register 0), I'm writing 10000000 (in binary) which I initially expected to not work at all, but later suspected might cause the multiplexer to switch to channel 7 (if it was writing to the control register on the TCA9548A instead of modifying the address pointer on the AD7746).

Clearly, when I request multiple bytes of data from the AD7746 through the multiplexer, I just get back the byte in the TCA9548A control register repeated 19 times. The AD7746 address pointer automatically increments to the next register after transmitting data to the master, so I should actually be getting data from each of the 19 registers (this worked when the microcontroller was connected directly to the AD7746 without the multiplexer).

--------------------------------------------------------
EXAMPLE OUTPUT #2
--------------------------------------------------------
Current data from register 0: 10000000
Current data from register 1: 10000000
Current data from register 2: 10000000
Current data from register 3: 10000000
Current data from register 4: 10000000
Current data from register 5: 10000000
Current data from register 6: 10000000
Current data from register 7: 10000000
Current data from register 8: 10000000
Current data from register 9: 10000000
Current data from register A: 10000000
Current data from register B: 10000000
Current data from register C: 10000000
Current data from register D: 10000000
Current data from register E: 10000000
Current data from register F: 10000000
Current data from register 10: 10000000
Current data from register 11: 10000000
Current data from register 12: 10000000
----------------------------------------------------------

If I try to read data from individual registers on the device on channel 7, I just get back out the address of the register I wanted to read from.

-------------------------------------------------------------------------
EXAMPLE OUTPUT #3
-------------------------------------------------------------------------
Current data from register 0 on device 7 : 0
Current data from register 1 on device 7 : 1
Current data from register 2 on device 7 : 10
Current data from register 3 on device 7 : 11
Current data from register 4 on device 7 : 100
Current data from register 5 on device 7 : 101
Current data from register 6 on device 7 : 110
Current data from register 7 on device 7 : 111
Current data from register 8 on device 7 : 1000
Current data from register 9 on device 7 : 1001
Current data from register 10 on device 7 : 1010
Current data from register 11 on device 7 : 1011
Current data from register 12 on device 7 : 1100
Current data from register 13 on device 7 : 1101
Current data from register 14 on device 7 : 1110
-------------------------------------------------------------------------

There is clearly something wrong when I attempt to read data from the AD7746 through the multiplexer. This also means I have no way of knowing if I am able to write to the AD7746 either. My code worked when I just had the microcontroller connected to the AD7746, so I must believe the issue is with the multiplexer. My current code has been modified to use the correct I2C address for the multiplexer and is running at a 100kHz clock rate.

Has anyone else encountered similar problems to this? Is the TCA9548A compatible with multi-register I2C devices at all?

  • Hello,

    I'm not yet sure what may be causing this behavior. Do you think you could use an oscilloscope to observe the I2C waveforms at either side of the TCA9548A for your commands used to change channels as well as to read from your converter? I want to verify both that you are sending the right I2C commands and also that the switch is not introducing any issues (since the direct connection between MCU and converter is able to work).

    Max
  • Hi Max,

    I've attached pictures of the clock and data line waveforms before and after the MUX. After the MUX, both lines are held high at 3.3V. Before the MUX, the waveforms arent' perfect by any means but they at least look like they're doing something. The pictures go in this order [SCL before MUX, SDA before MUX, SCL after MUX, SDA after MUX].

     

  • Hi kush,

    Thanks for taking a look at these. Since there is no toggling on the output of the mux, are you sure that the channel you are observing is active? Are you able to successfully read and write from the mux's control register?

    Regards,
    Max
  • Hello Kush,

    We need to see the I2C transaction to program the MUX.  I want to see if you are generating a stop condition after you program the bus.  We require that to initiate the command to turn on channels.  I would like to see SDA and SCL from the master on one scope shoot. 

    I have seen many people make the mistake of writing to the device but not doing a stop condition afterwards, which means it is loaded in the register but not executed.

    -Francis Houde

    p.s. let me know if that was the problem.

  • Hi Max,

    I actually have it working now. I believe the issue was with I2C stop bits being sent to the multiplexer, or rather not being sent. I was using repeated starts since the AD7746 resets its address pointer when it receives a stop bit, but the TCA9548A has to receive a stop bit for further bits to be sent to the appropriate I2C channel. Since I wasn't sending a stop bit, I was just repeatedly writing to and reading from the TCA9548A control register.

    Thanks,
    Kush

  • Hi Francis,

    Thanks for the suggestion -- I believe the issue actually was with STOP conditions, as I wrote in my reply to Max. I was using repeated START conditions instead of STOPs since STOPs were inconvenient for my slave device, but I needed to send a STOP to the TCA9548A to conclude communication with the control register. Since I wasn't sending any STOP conditions, I was just writing to and reading from the control register over and over again.

    I've fixed that and now my application is working properly with multiple slave devices.

    Thanks,
    Kush