Can't interrupt running program #16766
-
Hi All, I have been experimenting with using Pycharm with its Micropython plugin to program my Pico2. After a lot of mucking around I finally got it to work. The first thing I found I had to do is create a configuration file for micropython with an empty path that will flash the device then run the program. Otherwise the program will run on the computer and return errors like "module 'machine' not found". The second thing I learned, and this is the source of the problem, is that the Pycharm plugin will only run the whole project. i.e. it flashes the project (all the source files) to the device, then runs main.py. So, happily programming away and enjoying Pycharm's functionality over Thonny's, which is pretty primitive by comparison. Then I happened to make a change to the program that has caused a very tight endless loop. The result is that, when I plug in the Pico and try to reflash main.py to it (in Pycharm), it refuses to connect to the Pico, but times out. If I try it with Thonny all I see is a string of "soft reboot" messages, and no amount of resetting the device will interrupt it. I've tried reflashing the firmware, but that didn't erase the main.py. I've tried putting it in dfu mode to try to use dfu-util to reflash it, but Short of putting the Pico in the microwave, I've run out of ideas. Is there a way to erase all the user files on the Pico? Or a way to get dfu-util to talk to it? All advice gratefully received. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
you need the flash_nuke.uf2 file, which will completely erase the contents of flash, including main.py. It's extremely handy for un-hanging picos. It's in the github pico examples. You can find it just by googling, since its name is quite unique. |
Beta Was this translation helpful? Give feedback.
-
@mendenm Thank you! That did it. I'm keeping that file handy for next time I stuff things up. ;-) |
Beta Was this translation helpful? Give feedback.
you need the flash_nuke.uf2 file, which will completely erase the contents of flash, including main.py. It's extremely handy for un-hanging picos. It's in the github pico examples. You can find it just by googling, since its name is quite unique.