6. Reset and boot modes — MicroPython latest documentation (original) (raw)

MicroPython

This is the documentation for the latest development branch of MicroPython and may refer to features that are not available in released versions.

If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

There are soft resets and hard resets.

For more information, see Reset and Boot Sequence.

6.1. Safe boot

If something goes wrong with your WiPy, don’t panic! It is almost impossible for you to break the WiPy by programming the wrong thing.

The first thing to try is to boot in safe mode: this temporarily skips execution of boot.py and main.py and gives default WLAN settings.

If you have problems with the filesystem you can format the internal flash drive.

To boot in safe mode, follow the detailed instructions described here.

In safe mode, the boot.py and main.py files are not executed, and so the WiPy boots up with default settings. This means you now have access to the filesystem, and you can edit boot.py and main.py to fix any problems.

Entering safe mode is temporary, and does not make any changes to the files on the WiPy.

6.2. Factory reset the filesystem

If you WiPy’s filesystem gets corrupted (very unlikely, but possible), you can format it very easily by doing:

import os os.mkfs('/flash')

Resetting the filesystem deletes all files on the internal WiPy storage (not the SD card), and restores the files boot.py and main.py back to their original state after the next reset.