-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ESP32-S3 I2C timeout with seesaw #9535
Comments
If I run the I2C scan (https://learn.adafruit.com/scanning-i2c-addresses/circuitpython), it does see the device at 0x50, but can't "speak" to it |
It's hard to be sure without looking at the signals on the bus, but it looks like the seesaw device is crashing leaving the SCL line pulled low, that's why you get a timeout when the CircuitPython side waits on clock stretching, and it fails the test for pull-up resistors (because the line is kept low by the other side). Might be some combination of a bug in the seesaw device code, and different timings on different ports? |
Try setting the I2C busio frequency to 400000: i2c_bus = board.STEMMA_I2C() with import busio
# ...
i2c_bus = busio.I2C(board.SCL, board.SDA, frequency=400000) There's a thread here: https://forums.adafruit.com/viewtopic.php?p=978381 that suggests that at least in some circumstances, that helps. That thread was about an RPi (not Pico). As for the motor controller you mentioned in your forum thread, I have written to Kitronik, because I don't know whether there are pull-up resistors on their board. They don't appear to publish a schematic. |
I have tried with your code, sadly shows exactly the same behavoir. @deshipu but with arduino code it seems to work fine. This is why i thought, it would be more on the circuit python side, as the hardware is the same, just running a different code on. Sadly I don't have the equipment for testing the bus, I only own a multimeter. |
I tried a similar seesaw board, Adafruit ANO Rotary Navigation Encoder to I2C Stemma QT Adapter, and was able to reproduce the problem, with both i2c_bus = busio.I2C(board.SCL, board.SDA, frequency=50000) Try that and see if it lets you proceed. |
This happens to me on the |
With this speed, it works perfect. |
@bill88t if I run this code: import microcontroller
microcontroller.cpu.frequency the output is: 240000000 which to me sounds like full speed |
@dhalbert If I test again with the motor driver, it's working now too. The only thing I have changed, is a bigger power supply (LiPo wit DC-DC Stepdown). Nothing changed in the code. |
@icebreaker87 Glad to hear on both counts. I will check about the 50000 speed requirement internally. And it sounds like it was power sag on the motor driver. |
This could be an artifact of our tick speed change from 100 to 1000. That shortens timeouts like:
We should change the timeouts to be tick speed agnostic. |
I'm having a very similar issue with I2C on QT-PY-ESP32-S2. I've come at it all kinds of ways, with one or multiple I2C devices and varying the I2C bus speed from 10_000 to 400_000. With these i2c devices:
When I do a i2c.scan() it never shows any devices, but I can "speak" to the rotaryio. When I enable the ssd1306, I get:
If I never do the i2c.scan(), seesaw-rotaryio and ssd1306 appear to work fine (I've tried different instances of ssd1306 hardware). In the case where I use only the seesaw-rotaryio and do i2c.scan(), the scan still shows no devices, I can communicate with the seesaw-rotario and my code speed decreases dramatically, e.g. 100+ loops/second becomes ~15 loops/second. Code below. Can anyone shed some light on this? Thanks,
|
as a workaround, I switched to |
might just be a workaround, and this might fix it: - adafruit/circuitpython#9538 see threads: - https://forums.adafruit.com/viewtopic.php?t=208556 - https://forums.adafruit.com/viewtopic.php?t=207715 - adafruit/circuitpython#4669 - adafruit/circuitpython#9535
I did try changing the number of ticks to 1000 in |
@Casa-Machinalia I could not duplicate the OP problem on ESP32-S2, so I've made your issue be a separate issue: #9561. |
I tested with a seesaw board on an ESP32-S3. I get ETIMEDOUT starting at CircuitPython 9.0.0. It works in 8.2.10. There have been no significant changes to
and it still fails. |
I think this might be the issue: espressif/esp-idf#13962 I'll update the IDF now to 5.3.1. |
I retested the code in the first post with a seesaw board and 9.2.0-beta.0, which has ESP-IDF 5.3.1. I am still getting ETIMEDOUT. If I lower the frequency to 50000, it works, as above. I'll move this forward to 9.x.x since it may need the new I2C driver (and that may not help either!). |
Testing this with the new ESP-IDF I2C driver in conjunction with testing #9561. |
I seem to be still encountering this error on different hardware using 9.20: adafruit/Adafruit_CircuitPython_seesaw#138 Apologies if that's not the same as using the ESP-IDF I2C Driver... that's still a bit over my head. |
CircuitPython version
Code/REPL
Behavior
Traceback (most recent call last):
File "", line 33, in
File "adafruit_seesaw/seesaw.py", line 342, in pin_mode_bulk
File "adafruit_seesaw/seesaw.py", line 329, in _pin_mode_bulk_x
File "adafruit_seesaw/seesaw.py", line 520, in write
OSError: [Errno 116] ETIMEDOUT
Description
This is the example code from adafruits gamepad qt guide. Get this everytime I try to run the code. After multiple tries, there is an error :
Traceback (most recent call last):
File "", line 27, in
RuntimeError: No pull up found on SDA or SCL; check your wiring
Bus this goes away if you unplug the board and power back on. On RP2040 based boards, it works out of the box (same CP version).
If I use the same hardware but with arduino code (also from gamepad qt guide), it works always.
Additional information
No response
The text was updated successfully, but these errors were encountered: