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: Selecting I2C Bus

Part Number: TCA9548A

Hello, I am using the TCA9548A I2C Bus Mux and I am confused how to Read/Write from each of the 8 I2C channels connected to the TCA9548 device. I am looking at the datasheet and I understand that Table 1 on page 16 this table shows how to set the I2C address of the TC9548. What I don't understand is how to read/write to say SD0/SC0, I don't understand Figure 10.

Can anyone help me please.

Thank you

Joe

  • Joe,

    Thanks for bringing this to E2E. Table 2 in the datasheet helps explain the write function a bit more for the TCA9548A.Each of the control bits is an enable for it's respective switch/downstream channel. Once the specific channel is chosen, the TCA9548A can then retrieve data from the device connected to that channel by using a read command rather than a write. Once the data is retrieved, the TCA9548A can then be written to again to enable a different channel, then data can be retrieved from said channels through a read command, and so on.

    Please let us know if you have any other questions.

    Regards,

    Eric Hackett

  • Eric,

    Hi, I think I got it. Let me chew on it for a moment and get back with you. I do have another question for you. Is it possible to have several I2C devices on one channel of the MUX?

    Thank you

    Joe

  • Eric,

    I have a slave device which is a Temperature Monitor is has 8-channels, which means it would have 8 registers. Is it possible to read those 8 registers using this MUX? I'm reading page 16 section 8.5.3 it has, "The TCA9548A is example of a single-register device..".

    Last, it seems to me that I can only read from slave devices when looking at page 17 example of writing.

    Joe

  • I think I have figured things out. Here is my understanding:

    In Step 1 you set the I2C address to the TCA9548, enable the Channel.

    In Step 2 write to to Channel

    In Step 3 read from the Channel

    Am I close?

  • When you enable a channel on the mux, it creates a direct electrical connection between SDA/SCL and SDx/SCx. All devices on all enabled channels are visible; you access them normally, and the mux ignores all transactions not targeting its own address.

    Please note that an I²C transaction is either read or write; you cannot do both write and read (as in step 3) without doing a repeated start.

  • Thank you very much. How about this:

  • You cannot write in a read transaction. And the start condition is always followed by the address/R/W byte.

    You have to write the register address first, and then read the value. (And this has nothing to do with the mux.)