Repository navigation
Connect to CircuitPython without waiting out timeouts - #166
Merged
Merged
Conversation
CircuitPython rebuilds its VM on every switch between the friendly and the raw REPL and drops what arrives meanwhile. Connect left raw REPL and entered it again at once, and so did the first command after it, so each waited out a 10 s or 8 s timeout for a banner that never came. - Wait for the friendly prompt after Ctrl-B on CircuitPython. - Skip the leave-and-reenter toggle after entering raw REPL, and stay in raw REPL when connect finishes. - Don't pulse DTR/RTS or wait 1.6 s on Raspberry Pi and Adafruit native-USB ports, which have no ESP32 download mode. - MPFTP_TRACE=1 writes the stages of a connect to stderr. Fixes #155
A pipe nobody read filled with trace lines and hung the connect.
…ompt The REPL pane dropped keys until the board had left raw REPL, which takes seconds on CircuitPython; it now holds them and sends them once it's there. The key that wakes CircuitPython's REPL starts a fresh VM, which drops the next Ctrl-A, so connect waits for the prompt first. The reset step no longer runs into a try with no time allowed.
… s for raw REPL A program that stops while the interrupts are still going out takes one of them as the key that starts the REPL, and the Ctrl-A after it was lost. The first raw-REPL try also allowed 3.5 s, and an RP2350 takes 3.2 s or more to answer.
…low stop A board sometimes misses the key sent straight after "Press any key", and then sat there until a raw REPL try 6 s later spent its Ctrl-A as the key: 12 to 15 s connects with code.py running. The key now goes again each second until the prompt shows. And a program that takes longer to stop than the storm lasts now gets a second to say so, instead of a raw REPL try that is lost waking the REPL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #155.
CircuitPython rebuilds its VM on every switch between the friendly and the raw REPL (
run_replinmain.c), and bytes that arrive during the rebuild are lost. Connect left raw REPL and entered it again straight away, and the first command after connect did the same, so each waited out a 10 s or 8 s timeout for a raw-REPL banner that never came. MicroPython switches at once, which is why it connected in 1.8 s.What changes:
MPFTP_TRACE=1writes each stage of a connect to stderr (mpftp trace +seconds stage), which the desktop app keeps inhost.log.cli/tests/fake_circuitpython.pyis a serial port that behaves like CircuitPython 11 (code.py, "Press any key", VM rebuild on mode switch, raw paste).test_cp_connect_time.pyholds time and mode-switch budgets against it; they fail onmain.Not measured on a real board yet.