Embedded Systems & Firmware
You want to connect two identical I2C temperature sensors to the same I2C bus, but both have the same address. Which is a correct solution?
- AJust connect them; the microcontroller will tell them apart automatically
- BSwap SDA and SCL on one of them
- CChange one address via its address-select pins, or put them on separate I2C buses
Show answer and explanation
Answer: C. Change one address via its address-select pins, or put them on separate I2C buses
I2C selects devices by address, so two devices with the same address would respond together and corrupt the communication. Many parts let you change part of the address by tying pins to supply or ground. If that is not possible, use another I2C peripheral on the microcontroller or separate the devices with an I2C bus multiplexer.
- A. With the same address, both would respond at once.
- B. Swapping the lines would stop communication.
- C. Correct. Addresses must not collide.