WDT reset cause incorrect for ESP8266EX

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
tttonyyy
Posts: 1
Joined: Wed Aug 21, 2019 7:52 am

WDT reset cause incorrect for ESP8266EX

Post by tttonyyy » Wed Aug 21, 2019 8:03 am

Hi all, noticed this on a D1 mini with ESP8266EX - is it just me or is?

This sequence follows a hard reset (via RTS pin)

>>> machine.reset_cause()
6
>>> machine.HARD_RESET
6
>>> machine.reset()

MicroPython v1.11-8-g48dcbbe60 on 2019-05-29; ESP module with ESP8266
Type "help()" for more information.
>>> machine.reset_cause()
4
>>> machine.SOFT_RESET
4
>>> machine.WDT()
<WDT>
>>>

MicroPython v1.11-8-g48dcbbe60 on 2019-05-29; ESP module with ESP8266
Type "help()" for more information.
>>> machine.reset_cause()
3
>>> machine.WDT_RESET
1

It would seem that machine.WDT_RESET should be 3 - is it just my variant of this chip or a mistake in the library?

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

Re: WDT reset cause incorrect for ESP8266EX

Post by jimmo » Wed Aug 21, 2019 1:31 pm

tttonyyy wrote:
Wed Aug 21, 2019 8:03 am
It would seem that machine.WDT_RESET should be 3 - is it just my variant of this chip or a mistake in the library?
If you look up the ESP headers, the definitions are:

Code: Select all

enum rst_reason {
    REASON_DEFAULT_RST        = 0,
    REASON_WDT_RST            = 1,
    REASON_EXCEPTION_RST    = 2,
    REASON_SOFT_WDT_RST       = 3,
    REASON_SOFT_RESTART     = 4,
    REASON_DEEP_SLEEP_AWAKE    = 5,
    REASON_EXT_SYS_RST      = 6
};
So WDT_RESET is correct, but it looks like SOFT_WDT_RST needs to be added to esp8266/modmachine.c

Can you send a PR to add this?

Post Reply