I'm using an ESP8266 (NodeMCU v3). I want to set a PIN high if a soft wdt reset
occurs (not expecting one). Is there a way I can do that?
Can I attach something on TX pin of the board and watch for crash dump? Maybe another Arduino?
I'm using an ESP8266 (NodeMCU v3). I want to set a PIN high if a soft wdt reset
occurs (not expecting one). Is there a way I can do that?
Can I attach something on TX pin of the board and watch for crash dump? Maybe another Arduino?
The ESP provides a reset reason API, which lets you differentiate between a crash and a normal reset:
extern "C" {
#include "user_interface.h"
}
const char * const RST_REASONS[] =
{
"REASON_DEFAULT_RST",
"REASON_WDT_RST",
"REASON_EXCEPTION_RST",
"REASON_SOFT_WDT_RST",
"REASON_SOFT_RESTART",
"REASON_DEEP_SLEEP_AWAKE",
"REASON_EXT_SYS_RST"
};
// .. in setup():
const rst_info * resetInfo = system_get_rst_info(); //populate reset info
String diag = String(RST_REASONS[resetInfo->reason]); // turn enum index to string
if(diag == "REASON_SOFT_WDT_RST") digitalWrite(TX, HIGH);// check string, take action
The ESP8266 should hold the pin LOW when it is active, letting it go high then signals that the program has crashed.