Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ports/espressif/common-hal/busio/I2C.c: add delay after probe #9942

Merged
merged 1 commit into from
Jan 9, 2025

Conversation

dhalbert
Copy link
Collaborator

@dhalbert dhalbert commented Jan 8, 2025

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.

Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is just for one type of mcu, is it worth enclosing this in a #if block? Otherwise, it'll add about 1/8 second to any scan. which is probably fine.

@dhalbert dhalbert requested a review from jepler January 9, 2025 00:19
@dhalbert
Copy link
Collaborator Author

dhalbert commented Jan 9, 2025

I force-pushed an amended commit that only adds the delay for ESP32-S2, and tested it.

Copy link
Member

@jepler jepler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I see the fix has been confirmed by a tester, as well.

@dhalbert dhalbert merged commit 77b9880 into adafruit:main Jan 9, 2025
226 checks passed
@dhalbert dhalbert mentioned this pull request Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ESP32- S2 - i2c scan returns multiple bogus addresses
2 participants