uasyncio and inaccessible REPL

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
rtborg
Posts: 16
Joined: Tue Sep 07, 2021 6:01 am

Re: uasyncio and inaccessible REPL

Post by rtborg » Tue Nov 09, 2021 9:39 am

Thank you for the input. That is certainly a way to rescue your files after being "locked out" of the REPL, but doing that every time you want to reprogram the Pico or make small changes to the existing firmware is too much overhead.

What I've done now, to keep me going, is connected a push button to the Run pin of the Pico. When I run my main.py, close the IDE and the open it again, I get:

Code: Select all

Device is busy or does not respond. Your options:

  - wait until it completes current work;
  - use Ctrl+C to interrupt current work;
  - use Stop/Restart to interrupt more and enter REPL.
The options listed above do not work; however, when I press the push button, the IDE prints:

Code: Select all

Connection lost (device reports readiness to read but returned no data (device disconnected or multiple access on port?))

Use Stop/Restart to reconnect.
Now when I press Stop/Restart backend, the REPL appears; that's an ugly workaround, but it's functional enough.

As a side question, does anyone know what exactly does Stop/Restart backend in Thonny does?

User avatar
Roberthh
Posts: 3668
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: uasyncio and inaccessible REPL

Post by Roberthh » Tue Nov 09, 2021 10:47 am

OK. So in the end it looks like a Thonny issue.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: uasyncio and inaccessible REPL

Post by dhylands » Tue Nov 09, 2021 4:47 pm

Just a shot in the dark here.

It is possible to set the REPL to ignore Control-C and I know that rshell does this while doing file transfers, but then it restores the setting when its done.

You might want to try adding this to your code and see if that helps:

Code: Select all

import micropython
micropython.kbd_intr(0x03)

rtborg
Posts: 16
Joined: Tue Sep 07, 2021 6:01 am

Re: uasyncio and inaccessible REPL

Post by rtborg » Tue Nov 09, 2021 7:00 pm

It's not only Thonny - rhsell and Mu can't connect either.

Tried adding the code from above, but that did not give any results.

Post Reply