But wait! There's more!
A single TCA9548A muxer allows for up to 8 same address I2C devices. But what if you want more than 8? As mentioned previously, the I2C address of the TCA9548A itself can be changed. This allows using more than one muxer - up to 8 TCA9548As. So with 8 muxers having 8 channels each, that allows for up to 64 total same address devices.
This requires a little more effort in user code. The host controller's I2C bus will see everything on any active channel(s) of any TCA9548A(s). When using a single TCA9548A, we just activated one channel at a time. When using multiple TCA9548As, the same general approach is taken - only one channel on one TCA9548A will be active at any given time. This means all the other channels for all the other TCA9548As should be "deactivated". This is done by sending a 0 to the channel select control register.
The CircuitPython library for the TCA9548A takes care of that for you under the hood. For Arduino, this must done in user sketch code.
Example Setup
We'll show code for an Arduino example and a CircuitPython example based on the following hardware setup.
We are intentionally not using the BME280's alternate address - so each BME280 has an address of 0x77. The first TCA9548A is using the default 0x70 address. For the second TCA9548A, the address has been set to 0x71 using the address select solder jumpers.
Setting the TCA9548A I2C Address
The host I2C controller will always see each TCA9548A attached. Therefore, each must have a unique I2C address. Up to 8 different addresses can be set.
In the table above, L (for "low") is with the address jumpers open / unsoldered - i.e. their default configuration. H (for "high") is set by adding a solder blob to short out the two pads of the jumper.
Text editor powered by tinymce.