External "machine.reset()"

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
HermannSW
Posts: 197
Joined: Wed Nov 01, 2017 7:46 am
Contact:

External "machine.reset()"

Post by HermannSW » Fri Mar 05, 2021 5:12 pm

I don't know how useful this feature is, but you can reboot Pico Micropython as if "machine.reset()" was called, without having a Micropython session open, or during eg. a while loop is active. Only 8 lines of C code needed to be added once to "pico/micropython/lib/tinyusb/src/tusb.c". After that this command can reboot the USB cable connected Pico:

Code: Select all

sudo stty -F /dev/ttyACM0 2400
More details on how the changes allow to use "flash" tool with the changes here:
https://www.raspberrypi.org/forums/view ... 5#p1831365
Peek_2021-03-05_17-58.gif
Peek_2021-03-05_17-58.gif
Peek_2021-03-05_17-58.gif (72.25 KiB) Viewed 1429 times
Pico-W Access Point static file webserver:
https://github.com/Hermann-SW/pico-w

Tiny MicroPython robots (the PCB IS the robot platform)
viewtopic.php?f=5&t=11454

webrepl_client.py
https://github.com/Hermann-SW/webrepl#webrepl-shell

User avatar
jimmo
Posts: 2754
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: External "machine.reset()"

Post by jimmo » Thu Mar 11, 2021 6:22 am

That's really neat! Thanks for sharing

I've seen a similar trick where changing the parity mode allows switching between multiple virtual serial consoles on the same USB VCP.

Post Reply