Nested I2C multiplexers

i2cmultiplexer

I want to provide 12 actuators from a microcontroller (Particle Core) over I2C. The problem is that the drivers for the actuators have all the same I2C addresses. So I'am considering to use I2C multiplexers. However I only have found a 1 to 8 channel I2C multiplexer like the TCA9548A from Texas Instruments. The idea now is that I have 1 multiplexer connected directly to the microcontroller. This multiplexer is connected to 3 further multiplexers and each of them is connected to 4 actuator drivers.
My question now is, if it is possible to nest such I2C multiplexers?
Thanks in advance!

Best Answer

In terms of your question directly, yes it should be possible to stack the multiplexers, as long as each layer of mux has a different address from the previous layer. For example, if you stack two multiplexers deep in the following sort of arrangement:

   L1     L2

          /|---
    /|---|B|
   | |    \|---
---|A|
   | |    /|---
    \|---|C|
          \|---

Then the multiplexers are L1 would have one address to control these select lines, and then the multiplexers at L2 need an address different to that of L1. A could have an address of 0x10 and both B and C could share the same address of 0x12 for example.

For this to work, you would first send a packet to mux A to select which of the second level muxes you want to talk to. Then you would send a packet to either B or C to select which device to talk to. Then you could send packets to your device. This could take up to 40 or more I2C bit periods before you could talk to one of the devices. The deeper you stack them, the higher the overhead.


While not directly answering the question of whether mutliplexers can be stacked, there are alternatives. There is a related question here which is about I2C address conflicts. @user3608541 points out in his answer that there exist ICs which can perform address translation. Specifically he gives an example of the LTC4316.

To expand on that answer, these ICs perform address translation on-the-fly. Essentially they connect in line between the I2C master and slave devices and monitor communication between the two. When a start bit is sent, the following byte is always the address of the device. The address translation IC monitors for the start bit, and once detected will make modifications to the address as it goes through. In the case of the LTC4316, the modifications are simple addition - the master sends one address, and the slave receives the packet but with the address having had some constant factor added on to it. The rest of the packet goes through unmodified.

The net result of this is if you have many copies of the same fixed-address device, you can place each one behind an address translation IC, and configure the ICs to add on different factors. For example, the first one adds on 1, the second adds on 2 and so on. This would mean that to contact the first slave, the master would have to talk to its address minus 1. To talk to the second slave the master would have to minus 2. This gives each one a unique address.

Now whether these ICs are cheaper than multiplexers, I don't know (a quick DigiKey search shows them at $3 each for low quantity), but they have a distinct advantage in that you don't have the extra overhead of time spent selecting the correct output of the multiplexer.