adafruit / circuitpython

CircuitPython - a Python implementation for teaching coding with microcontrollers
https://circuitpython.org
Other
4.12k stars 1.22k forks source link

synthio related bug on rp2040 / Pico - LFO on blocks stops running, KeyboardInterrupt interrupts but no REPL #9782

Open kevinjwalters opened 2 weeks ago

kevinjwalters commented 2 weeks ago

CircuitPython version

Adafruit CircuitPython 9.1.4 on 2024-09-17; Cytron EDU PICO W with rp2040

Code/REPL

v1.1 of synthio-pwm-workaround-benchmark.py - I'm not sure what part of that is causing problem

Behavior

The code runs but careful inspection of output indicates misbehaviour and Control-C appears to work but doesn't go all the way to REPL and maybe 15 seconds later the desktop o/s says there's a USB problem (serial connection running over USB).

It takes a few minutes to occur, it's not at an exact time. Here it's 241 seconds from time.monotonic_ns() and I've had other runs around 138 and 196.

DELTA 241.008 [22, 6, 16, 12, 16, 22, 45]
CP (ms) [1.7395, 0.671382, 1.25122, 1.0376, 1.3733, 1.64794, 4.36401]
ULAB (ms) [8.20922, 14.5874, 13.5498, 7.84302, 14.4348, 14.4653, 14.1907]
DELTA 241.212 [22, 11, 11, 11, 17, 28, 11]
CP (ms) [1.7395, 1.09862, 1.00708, 0.976562, 1.86157, 2.13623, 1.06812]
ULAB (ms) [7.99561, 13.3972, 14.4348, 7.75146, 14.1296, 13.3057, 12.3291]
DELTA 241.212 [0, 0, 0, 0, 0, 0, 0]
CP (ms) [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
ULAB (ms) [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
DELTA 241.212 [0, 0, 0, 0, 0, 0, 0]
CP (ms) [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
ULAB (ms) [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
DELTA 241.212 [0, 0, 0, 0, 0, 0, 0]

And this is what a control-c looks like, no >>> REPL` prompt.

DELTA 241.212 [0, 0, 0, 0, 0, 0, 0]
CP (ms) [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
ULAB (ms) [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
Traceback (most recent call last):
  File "code.py", line 150, in <module>
KeyboardInterrupt:

Code done running.

Description

No response

Additional information

This is on an EDU PICO but that's basically a Pi Pico W sitting on some hardware. I wasn't using displayio console. I'd assume this will reproduce on a Pi Pico W.

May not be synthio, small chance it's ulab or something else...

Noted while benchmarking for functionality workaround in #9780