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?

  1. AJust connect them; the microcontroller will tell them apart automatically
  2. BSwap SDA and SCL on one of them
  3. 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.
Practice this topic Back to topic

More Embedded Systems & Firmware questions

  1. Which comparison of UART, SPI and I2C is correct?
  2. What is the difference between polling and interrupts as ways to learn a peripheral's status?
  3. Which describes the "super loop" structure often seen in microcontroller programs without an OS?
  4. What is the main purpose of using an RTOS (real-time operating system) in embedded devices?
  5. In a preemptive RTOS, while a low-priority task is running, a high-priority task receives the data it was waiting for and becomes ready. What generally happens?