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?