ESP8266 Reset Causes – rst cause

ESP8266 reset causes can be many. The nonOS and RTOS SDK both provide APIs to retrieve the last reset cause. But if you do not want to use the SDK, you can monitor the reset cause by analyzing the debug messages from the ESP8266 UART port every time the chip is reset.

 

Boot Message

The ESP8266 reset cause is a part of the boot message string that is printed via the UART port with the default baud rate every time ESP8266 is reset (including power-on-reset).

An example boot/reset message is shown here, with the reset cause indication highlighted:

ets Jan  8 2013, rst cause:5, boot mode:(3,7)
ets_main.c

 

rst cause Values

  • rst cause : 1
    Power-on-reset, indicates that the ESP8266 went through a power cycle and rebooted as a result of that.
    Often seen randomly if your power supply is dodgy.
  • rst cause : 2
    External reset is triggered by the reset pin of the ESP8266. This is the reason you would see when the ESP8266 is reset explicitly via the pin or when the ESP8266 wakes up from deep sleep (because that involves a GPIO driving the reset pin).
  • rst cause : 4
    Hardware watchdog reset, triggered when your code is stuck or malfunctioning. This is usually a result of improper loading of watchdog timer, which is enabled by default on the SDKs provided by Espressif.




Leave a Reply

Your email address will not be published. Required fields are marked *

11 − 2 =