← index #8594Issue #6903
Related · high · value 0.830
QUERY · ISSUE

Enable factory reset boot mode without a user switch

openby cdwilsonopened 2022-04-29updated 2026-03-19
enhancement

The documentation at https://docs.micropython.org/en/latest/pyboard/general.html describes a "filesystem reset" boot mode which can be triggered by holding down the user switch during the power up boot sequence:

filesystem reset: resets the flash filesystem to its factory state, then boots in safe mode.

For supported MicroPython boards that do not have a user switch (e.g. SparkFun MicroMod STM32 Processor), is there any way to trigger a "filesystem reset" from software?

If not, would it be possible to add a new machine.factory_reset() function to enable this? (similar to the machine.reset() and machine.soft_reset() functions described in https://docs.micropython.org/en/latest/library/machine.html?highlight=reset#machine.reset)

For the sake of completeness, it would also be nice to support resetting into the "safe boot" boot mode from software as well through something like a machine.safe_reset() function.

CANDIDATE · ISSUE

STM32: Can't Factory Reset

closedby braidenopened 2021-02-15updated 2021-03-10
bugport-stm32

Expected Behavior:

  1. While Holding User Button
  2. Press Reset Button
  3. Release User Button after 3 flashes
  4. Devices echos back 3 flashes
  5. Files-system should be restored to default state.

?

Or am I misunderstanding how it's supposed to work?

I had to change this line:
https://github.com/micropython/micropython/blob/bffb71f523e4bcc21b913af291deeb67091bed88/ports/stm32/main.c#L534

to: mounted_flash = init_flash_fs(state.reset_mode);

... since https://github.com/micropython/micropython/blob/bffb71f523e4bcc21b913af291deeb67091bed88/ports/stm32/main.c#L475 only updates state.reset_mode not reset_mode.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied