Electronic – What I2C address should I choose

i2c

Now I know in order to have an I2C address reserved for yourself you have to pay the I2C people some money. But I don't want to do this.

I'm asking for advice on what address I should choose for my slave and master MCUs on my project. There will also be an EEPROM on the board. So I will avoid using the address of the EEPROM. I plan for the master to connect to a wide range of sensors, including gyros and accelerometers, and perhaps additional memory devices. Are there any blocks of addresses I should stay clear of? I was thinking of just using 0x00 for the master and 0x01 for the slave, because those seem to be rarely used.

Another question: would it be a bad idea to mix 10-bit devices and 7-bit devices on the same bus? I was considering the possibility of having my MCUs communicate with 10-bit addressing, but only using 7-bit addresses for sensors.

Best Answer

First, don't use 0x00 and 0x01, those are reserved! Table 3 of the I2C Bus Specification lists the reserved addresses (and reasons why):

Slave addr  R/W        Description
 0000 000    0     General call address
 0000 000    1     START byte
 0000 001    X     CBUS address
 0000 010    X     Reserved for different bus format
 0000 011    X     Reserved for future purposes
 0000 1XX    X     Hs-mode master code
 1111 1XX    1     Device ID
 1111 0XX    X     10-bit slave addressing

You should also steer clear of 0x00 because that has no edge transitions, and might be an error condition (and it's hard to debug).

Other than that, I'd say "Just make it configurable." If you want to be able to plug in a wide variety of sensors, then you can either pay NXP for an address, or give it adjustable addresses. Software modifications should be obvious if you want to distribute the source code. A hardware option to toggle one or two bits of your selected address (solder jumpers on digital pins) is cheap and easy, or a ladder network of resistors with jumpers connected to an A/D pin could give you complete control in the hardware.