ports/espressif/common-hal/busio/I2C.c: add delay after probe #9942
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ESP32-S2 started returning bogus I2C probe successes after #9671, when I switched to using
i2c_master_probe()
instead of using our home-grown bus probe.I inserted a debugging print and the problem went away. That suggested a timing issue. I added a 1ms delay and it's now fine.
I tested ESP32-S3, ESP32-C6, and ESP32, and they all don't have this problem. I could conditionalize the delay to just ESP32-S2, but it's a short delay and might prevent future problems.
I also wondered whether the problem was peculiar to boards with the MAX17048 or other I2C battery gauge. But I was able to reproduce the problem on a Metro ESP32-S2 with an I2C OLED display. So it's as more general problem.
I didn't find any reports of this in https://github.com/espressif/esp-idf/issues, so I may open an issue there at some point.