Pico freezes very regularly

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
APinto
Posts: 13
Joined: Fri Feb 25, 2022 11:47 am

Pico freezes very regularly

Post by APinto » Mon Mar 07, 2022 1:28 pm

Hello,

I'm using a Pico running the latest nightly MicroPython release. I am also having this problem with the latest stable release.

The board freezes randomly from time to time. Sometimes when I upload a file it stalls and I eventually get a timeout. Other times when code is running, the code continues running normally but I can't do anything else like stopping the code, resetting, etc. It's as if the board lost communication with the PC (Windows 10).

The only option when this happens is to unplug the USB connection and start again. This happens 1/3 of the times I try to upload a file or run code from the IDE. I'm using Vusual Studio Code with the Pico-Go module, all updated.

Is anyone experiencing the same? Thank you!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Pico freezes very regularly

Post by pythoncoder » Tue Mar 08, 2022 9:29 am

I have done a lot of work with several Picos and never seen this. However I use Linux with rshell or mpremote. I suggest giving the official mpremote a try: upload a few files and see if it falls over. This would point to whether the fault is with your hardware or the software tools.
Peter Hinch
Index to my micropython libraries.

APinto
Posts: 13
Joined: Fri Feb 25, 2022 11:47 am

Re: Pico freezes very regularly

Post by APinto » Tue Mar 08, 2022 12:48 pm

Thank you, I'll give it a go. I really like the Visual Studio Code integration though, it would be a shame if I had to change!

I suspect that the USB link gets into a weird state and the only way to fix it is to power down the board and relink. But I can't find a way to debug it.

yjchun
Posts: 10
Joined: Fri Aug 27, 2021 8:04 pm

Re: Pico freezes very regularly

Post by yjchun » Wed Mar 09, 2022 3:16 am

I am having frequent hang as well. Cannot connect to REPL and cannot break out from a loop with CTRL-C. Since then I
- Do not run main loop in main.py. Expose run() function to manually start from REPL.
- Use SWD to upload frozen code.
- Connect reset switch to rp2.

Related issues:
https://github.com/micropython/micropython/pull/8040
https://github.com/micropython/micropython/issues/8332

Didn't investigate it further since I am happy in my current setup.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: Pico freezes very regularly

Post by pythoncoder » Thu Mar 10, 2022 11:28 am

See my comment to the second issue: the code runs OK and it seems to be an IDE problem.
Peter Hinch
Index to my micropython libraries.

yjchun
Posts: 10
Joined: Fri Aug 27, 2021 8:04 pm

Re: Pico freezes very regularly

Post by yjchun » Thu Mar 10, 2022 1:12 pm

pythoncoder wrote:
Thu Mar 10, 2022 11:28 am
See my comment to the second issue: the code runs OK and it seems to be an IDE problem.
You're right. I verified that too. Thank you.

Delebel
Posts: 48
Joined: Thu May 25, 2017 2:21 pm
Contact:

Re: Pico freezes very regularly

Post by Delebel » Mon Mar 14, 2022 8:21 pm

I get a similar problem when trying to use PyCharm. I used a very simple blink.py as a start and as you mentioned it works once when the Pico is has just been connected but fails for subsequent run/debug attempts no matter if I do Crtl-D or Crtl-C I tried. I have been using Thonny but wanted to move to a more comprehensive IDE for development and learning. I also gave Visual code a try but after several attempts to load 1/2 dozen packages I never got passed go. The sheer size of the environment is just too daunting for me. It might be great for advanced users but I'm certainly not one of them. Using a windows platform is certainly not very compatible but the jump to Linux will entail even more of a learning curve. For now I might have to settle for Thonny.... : (

Post Reply