0

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!

Ditachi
  • 3
  • 1
  • What is the I2C driver? – Andy aka Dec 17 '15 at 14:28
  • Related question about address conflicts: http://electronics.stackexchange.com/questions/5096/how-to-resolve-i2c-address-clashes – Tom Carpenter Dec 17 '15 at 14:40
  • 2
    From that question, there exist ICs like [this one](http://cds.linear.com/docs/en/datasheet/4316fa.pdf) which when placed in between the master and an I2C slave will actually translate the address on the fly. E.g. you can have every device with the same address, but place a translator in front of each that maps them all to a different address on the master side. – Tom Carpenter Dec 17 '15 at 14:42
  • @Andyaka DRV2605 from TI is used as motor driver – Ditachi Dec 17 '15 at 15:09
  • @TomCarpenter: Your second comment would be an excellent answer I'd certainly upvote! – EM Fields Dec 17 '15 at 15:15
  • @TomCarpenter Thanks Tom! Never thought about address translation. I will definitely consider that solution! – Ditachi Dec 17 '15 at 15:15
  • Am I reading the datasheet of the TCA9548A wrong or can't you just wire two of these in parallel (different addresses), connect 6 drivers to each TCA and switch one to an unconnected channel while the other is active (so the selected slaves don't collide)? – Arsenal Dec 17 '15 at 15:25
  • @EMFields done. – Tom Carpenter Dec 17 '15 at 15:40
  • @Arsenal You are absolutely right! Better than go the nested solution. – Ditachi Dec 17 '15 at 15:55

2 Answers2

1

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.

Tom Carpenter
  • 63,168
  • 3
  • 139
  • 196
1

I don't think you actually need to nest the multiplexers. The TCA9548A allows you to turn off all downstream ports. So you could do what you want with just a pair of them connected to the main processor (and set to different addresses).

Peter Green
  • 21,158
  • 1
  • 38
  • 76