I had tried to use rpi as master to detect slave. The slave is MCU, using polling to answer rpi's request.

However, when I tried to use rip to check the slave address, using command :

i2cdetect -y 1

It couldn't detect anything.

After I changed the way, using interrupt in slave, tried " i2cdetect -y 1" again

It finally detects success. Rpi catch my slave address correct.

Why rpi uses i2cdetect slave can not detect the way of polling but interrupt can ?

I just know when a device sees its address it is meant to acknowledge its presence by pulling SDA low. If SDA isn't pulled low then the device is not present.

Is that mean when I using polling SDA is low, and change to interrupt SDA would be high when i2cdetect signal come?

  • You have to look for the problem on the slave side as the i2cdetect command does exactly the same both times. – Janka Aug 30 '19 at 0:42
  • I don't really understand the question. The slave must pull SDA low within one I2C clock of seeing its address on the bus. At the default bus speed this means it must respond within 10 µs. – joan Aug 30 '19 at 9:02

I think the reason is that your I2C slave if set to polling mode is too slow for the i2cdetect program to wait for a response. Usually i2cdetect scans the 256 addresses in the range very fast, expecting the slaves, usually sensors etc, to respond almost immediately, as fast as being interrupted (Of course sensor does not use polling or interrupt, it just respond immediately.)

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.