You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A board whose callback floods the REPL leaves exec and ls waiting with no explanation #193
On an ESP32-S3 that only has its native USB for serial (LilyGO T-Embed), a periodic machine.Timer whose callback prints on every tick, with no way to stop itself, leaves mpftp exec and mpftp ls waiting. In our run exec was still going after 77 s, hard-reset hung, and a plain serial read still showed the board's output scrolling, which looks like a working port. Ctrl-C, Ctrl-D and a WebREPL session could not get a line through, and the host cannot reset a native-USB S3 (DTR/RTS reach nothing), so the board needed its RESET button.
Steps
# on the boardimportmachinet=machine.Timer(3)
t.init(period=3, callback=lambdat: print("tick tick tick tick tick tick tick"))
Then mpftp ls -d COM5 / and mpftp exec -d COM5 "print(1)".
What we saw
A flood that ends by itself (the callback deinits the timer after a few thousand ticks) is handled: ls and exec finish in about 4 s.
A flood that never ends is not. Reading the port works, so the board looks alive; the REPL never answers. mpftp neither returns the "board is stuck in a callback" advice that it gives for an unopenable port nor times out in a bounded time.
What would help
Give the connect path an overall deadline that applies even while bytes keep arriving (mpremote's timeout is between bytes, so continuous output defeats it), and when it expires say the board is printing continuously and does not answer, and that a native-USB board needs its RESET button.
Checked on a board with main at 6032cf2 (#196), on the LilyGO T-Embed (ESP32-S3, native USB only, MicroPython 1.30.0-preview.160), with the timer from the steps above printing every 3 ms (set to stop itself after 100 or 300 s so the board recovers):
Command during the flood
mpftp 0.1.5 (released)
main
mpftp exec -d COM5 "print(1)"
still waiting at 97 s, no output
returns at 46 s
mpftp ls -d COM5 /
returns at 47 s
mpftp hard-reset -d COM5
returns at 47 s
What main prints each time:
COM5 kept sending output for 45 s and never answered the REPL, so mpftp gave up. A program that prints continuously (a timer callback that never stops, say) keeps the board from listening. A board with only its native USB for serial can't be reset from the host: press its RESET button, then try again.
After a flood of 60 or 100 s ended by itself, exec answered in 5 to 12 s with no reset. The fix holds.
Activity
Give connect an overall deadline so a board that floods output ends w…
Overall connect deadline for boards that flood output (#196)
bdbarnett commentedon Oct 30, 2026
Checked on a board with main at 6032cf2 (#196), on the LilyGO T-Embed (ESP32-S3, native USB only, MicroPython 1.30.0-preview.160), with the timer from the steps above printing every 3 ms (set to stop itself after 100 or 300 s so the board recovers):
mpftp exec -d COM5 "print(1)"mpftp ls -d COM5 /mpftp hard-reset -d COM5What main prints each time:
After a flood of 60 or 100 s ended by itself,
execanswered in 5 to 12 s with no reset. The fix holds.