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

7.2.0-alpha.1 I2C issues when scanning the bus #5906

Closed
UnexpectedMaker opened this issue Jan 22, 2022 · 3 comments · Fixed by #5958
Closed

7.2.0-alpha.1 I2C issues when scanning the bus #5906

UnexpectedMaker opened this issue Jan 22, 2022 · 3 comments · Fixed by #5958
Labels
bug espressif applies to multiple Espressif chips
Milestone

Comments

@UnexpectedMaker
Copy link

CircuitPython version

Adafruit CircuitPython 7.2.0-alpha.1-189-g9a353a4f5-dirty on 2022-01-22; TinyS2 with ESP32S2
But really on any ESP32 board. S2 and S3.

Code/REPL

import board
import busio
i2c = busio.I2C(board.SCL, board.SDA)
while not i2c.try_lock():
    pass
    
[hex(x) for x in i2c.scan()]

Behavior

Scan hangs for 60-90 seconds, and then comes back with nothing found.
Confirmed on my TinyS2, TinyS3, FeatherS3 and corroborated with @prplz using the esp32s3 devkitc n8r8

Description

No response

Additional information

No response

@UnexpectedMaker
Copy link
Author

Ok, if the slave has pull-ups.... it seems to work, if multiple slaves connected and one has pull-ups, it works and finds them all, but if the one with pull-ups is removed, the next scan long hangs again.

If a slave with no pull-ups is connected and nothing else, it long hangs.

Only once I've see the "no pull-ups error".... every other time it hangs. I've plugged in and unplugged 4 different I2C modules, some with and some without pull-ups, I can't make sense out of what is happening.

@prplz
Copy link

prplz commented Jan 22, 2022

I did a little printf debugging and found that this for loop is taking about one second per iteration

This makes sense because i2c_master_cmd_begin is being called with a 10 tick timeout and we are using 100Hz FreeRTOS tick rate.

@tannewt tannewt added the espressif applies to multiple Espressif chips label Jan 24, 2022
@tannewt tannewt added this to the 7.x.x milestone Jan 24, 2022
@dhalbert
Copy link
Collaborator

dhalbert commented Feb 1, 2022

@prplz @UnexpectedMaker This was closed by #5958, and I reduced a timeout, but reopen or make a new issue if you are still seeing slow scan times, and we need something like #5908 (or comment in that PR).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug espressif applies to multiple Espressif chips
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants