1

I start a new project with Arduino UNO and MCP23017 expander. Using this, I can connect 8 chips on Arduino, by selecting different addresses ( from 0x20 to 0x27 ). My question is, if I connect two MCP23017 chips with the same address, there is any way to see somehow that I have two chips with the same address ? I am using a standard I2C scanner in Arduino code, but is nt return me if I have multiple chips with the same address, he see only one chip for example !

Can you please help me with some ideas to check how man chips are connected with the same address?

  • You can probably tell by the way you wired it and see what address you configured your slaves to be. Slaves have "address" pins. – KingDuken Dec 6 '19 at 19:58
1

It's my understanding that duplicate I2C addresses prevent the master from communicating from the slaved devices, so the answer is no.

Instead, connect the devices one at a time, run the I2C scanner, note the address for each, and take note of any duplicate addresses.

1

If both devices are the same, are configured the same, and respond the same, then it is impossible to tell if there is one, two, or four hundred.

However if there are differences between the two devices you will get corrupt data.

I2C is an open-drain protocol. For a device to send a 0 it pulls the data line low. For it to send a 1 it lets the pullup resistor pull the line high.

So if you have two devices and they both send a 1 you get a 1. If they both send a 0 you get a 0. But if one sends a 1 and the other sends a 0 then the 0 will "win" and you will see a 0.

Since most devices, when powered up, revert to some pre-defined default state, chances are you will always see multiple devices of the same type on a single address as just one device.

One possible way around it is to have some control signal that is unique to each device which will cause them to only respond one at a time. For example, you might choose to pull all the RESET pins of the slaves LOW and raise each one in turn to see what address the device is on. If you then see two that respond on the same address then you know you have a conflict and can report it as such.

Another possibility is to connect the address control pins to IO pins and communicate with all the slaves on the same address - but you only set one slave's address to the "live" address at a time. That also gives you the ability to have far more than just 8 slaves.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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