I was searching for IO expander IC, I plan to use multiple such chips on the same I2C bus (in the future potentially more than 8). And I was surprised that almost all chips that I looked at had only 2 possible addresses for example this (without programmable pins) or 8 addresses such as this.

But after a very long search, I found only one particular IC (XRA1200) that also has only 3 programmable pins but supports up to 32 addresses (by connecting programmable pins not only to Vdd or GND but also to SLC and SDA)

I have 2 questions:

  1. Why do all such ICs with identical structure (3 external programmable pins) not utilize such approach (Is it not stable? Does it require higher production costs to implement? Do other chip producers know about this? Is it harder to use?). As for me, it seems like just free 24 potential devices on the same bus.

  2. Why there are literally no chips where I could program an I2C address using an I2C register (the device would just have 1 writable register, where it would be possible to write a completely custom address)?

  • \$\begingroup\$ 2. I've seen an I2C chip that has the address programmable ... I think that it used a general broadcast address for setting the address register \$\endgroup\$
    – jsotola
    Commented Dec 12, 2022 at 22:12

3 Answers 3

  1. There are also other chips that use the same mechanism. Such as the ADS111x chip series.

Not all chips use it because they either have enough pins or in general have no use for multiple addresses. And even if you wanted 8 or more chips of the same kind to a system, you would likely partition the system with a bus multiplexer anyway, as having a lot of chips on same bus segment is a lot of capacitance and it can slow down the bus or make it work outside of I2C bus specs.

  1. There are chips with selectable I2C address by writing new address to a register, either storing it into volatile memory for run time or permanently into non-volatile memory. Usually chips with multiple I2C addresses have one or two base address select pins and the other addresses can be changeable via the base address. As an example with a freely downloadable data sheet, ADV7800. Other chips that I do know that work like this have no freely available documentation so I cannot disclose them. They still exist.

I'd like to add to Justme's excellent answer that there's also an economic aspect to this: The price you can demand for and I²C IO expander is limited by how much it simplifies design compared to using a cheap microcontroller to do the same job⁽¹⁾.

Now, that ease and robustness is gone in a system where you start programming your IO expanders. By all mean, spend one third of the price and buy a microcontroller. You get something whose address you can program arbitrarily, and you can add address-change logic as much as you like (which, for example, you see in thousands of firmwares of microcontrollers doing SMBUS do on a higher layer. SMBUS is directly built from I²C.)

So, if you want to have it simple, you'd go for an IO expander. If you need more than 8 IO expanders, and would be willing to program their addresses, either via elaborate hardware connections or through communications, I think you'll find yourself in territory where adding a microcontroller solves a problem, more than it adds one.
If you're in that group of people, no IO Expander with no matter how many possible addresses is very attractive to you – a simple 8/16/32 bit microcontroller is almost certainly available for less money, and comes with the ability to do exactly what you want, autonomously, instead of putting more data on a bus with very many devices on it:
If you have say 20 IO expanders, chances are your 400 kHz I²C will be busy when you need it most. It would be nicer if you could then just say "roll forward by 20°", instead of "bit banging" step motor control through the I²C bus, for example.

(1) As a matter of fact, I know people claiming that from the hardware quirks they encountered, some big-brand commercial I²C IO expanders are simply custom-packaged factory-programmed PIC microcontrollers of a very specific family.


Looks like a derivation on Google 2012 Patent Pin selectable i2c slave addresses from Fairchild.

I2C was developed by Philips in 1992 and uses 7 or 10 address bits, which means \$2^7 = 256\$ or \$2^{10} = 1024\$ unique addresses. Some of those addresses are reserved, but the most significant bits selected classes of devices and the least significant bits selected different chips of the same device. A portion of the address was hardcoded in the device and lower were circuit selectable to allow 4 to 8 different EEPROMs or ADC. 0x48 - 0x4F was meant for ADCs. 0x50 - 0x5F was meant for EEPROMs. To allow for more than that, you needed a second I2C bus or bus multiplexor.

Either way 256 or even 1024 addresses get used up over time.

The concept is quite cute. It addresses the problem of fitting multiple devices with a limited number of pins. There appears to be two versions. And it is being used quite extensibly for new chips to allow for multiple devices or alternative addresses to fix address conflicts.

One version uses SDA or SCL on A0 and A1 and the second uses float on A0, A1 or A2.

From INA219:

enter image description here

Two pins allow 16 different INA219's to occupy one I2C bus.

From PCT2075

enter image description here

Three pins allow 27 different PCT2075's to occupy one I2C bus. With different base addresses to allow greater flexibility if another I2C device has the same address.

Why do all such ICs with identical structure (3 external programmable pins) not utilize such approach?

I2C has aged well but at some point it comes down to how many of a specific device do you need. 2, 4 or 8 is a lot for many applications. This is a solution that addresses the problem. I2C mux or second I2C bus allows expansion. 16 current sensors or 27 temperature sensors seems like a limited target market. Everything is a trade off.

The actual number of devices connected to an I2C bus depends upon bus capacitance, frequency and distance, with a upper limit of 40 slaves. So it may be better to have two I2C busses with today's embedded controllers. Tradeoff!

Why there are literally no chips where I could program an I2C address using an I2C register (the device would just have 1 writable register, where it would be possible to write a completely custom address)?

So how do we address two identical devices at the same address to program them. One soltion: Use a GPIO to select individual device and program I2C address. Either way we need a GPIO pin per progammable device. Again, everything is a trade off.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.