machine.reset is not working properly ?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
Posts: 14
Joined: Thu May 16, 2019 12:44 pm

machine.reset is not working properly ?

Post by zmaier » Mon May 11, 2020 5:34 am


i am using a Wemos D1 Mini and i have troubles using machine.reset()

Here is the code of :

Code: Select all

import sys
import machine
from uio import StringIO
    import run.mpy
except KeyboardInterrupt:
except Exception as e:
    s=StringIO(); sys.print_exception(e, s)  
    payload="system exception=\"{1}\"".format(e)
My intention is, if a error occurs in run.mpy the error should be logged in the file error.txt and the Wemos should restart.
The Problem now, the error is logged correct, but the esp is not restarting.
I got the micropyhton-shell, it seems, that the and is not excecuted?

Doing Strg+D everthing is ok, donig a hardreset with the reset button, also everthing is working as expected.

Yes, i could catch the error within the run.mpy but, for debubing reasons i would like to do it that why :)
Any ideas why?

Posts: 782
Joined: Sat Feb 03, 2018 7:02 pm

Re: machine.reset is not working properly ?

Post by kevinkk525 » Mon May 11, 2020 5:42 am

Well I never tried it that way.
I always catch errors in and my machine.reset() has always worked reliable there. even in my watchdog implementation.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration):

User avatar
Posts: 214
Joined: Wed Jan 01, 2020 10:12 pm
Location: Santa Barbara, CA

Re: machine.reset is not working properly ?

Post by tve » Mon May 11, 2020 7:13 am

This doesn't help you with your reset problem, but I believe you could avoid the StringIO by doing sys.print_exception(e, temp).
Also, `with open("error.txt", "w") as temp:` is a nicer way to write the file I/O...

WRT reset, is the esp8266 going through a full system reset?

Post Reply