I already had various reset causes :p but someone maybe has a "official" list ? This would make debugging a bit easier.
Same for boot mode.
Explore... Chat... Share...
reset causes:
0:
1: normal boot
2: reset pin
3: software reset
4: watchdog reset
boot device:
0:
1: ram
3: flash
struct bootflags
{
unsigned char raw_rst_cause : 4;
unsigned char raw_bootdevice : 4;
unsigned char raw_bootmode : 4;
unsigned char rst_normal_boot : 1;
unsigned char rst_reset_pin : 1;
unsigned char rst_watchdog : 1;
unsigned char bootdevice_ram : 1;
unsigned char bootdevice_flash : 1;
};
struct bootflags bootmode_detect(void) {
int reset_reason, bootmode;
asm (
"movi %0, 0x60000600\n\t"
"movi %1, 0x60000200\n\t"
"l32i %0, %0, 0x114\n\t"
"l32i %1, %1, 0x118\n\t"
: "+r" (reset_reason), "+r" (bootmode) /* Outputs */
: /* Inputs (none) */
: "memory" /* Clobbered */
);
struct bootflags flags;
flags.raw_rst_cause = (reset_reason&0xF);
flags.raw_bootdevice = ((bootmode>>0x10)&0x7);
flags.raw_bootmode = ((bootmode>>0x1D)&0x7);
flags.rst_normal_boot = flags.raw_rst_cause == 0x1;
flags.rst_reset_pin = flags.raw_rst_cause == 0x2;
flags.rst_watchdog = flags.raw_rst_cause == 0x4;
flags.bootdevice_ram = flags.raw_bootdevice == 0x1;
flags.bootdevice_flash = flags.raw_bootdevice == 0x3;
return flags;
}
I was searching for following scenario: power latc[…]
I have a potential bare-metal ESP8266 project whic[…]
It is possible (at least when you use SDK) if you […]
The post below relates to the gen4-IoD-32T displa[…]
I think the line previousState == state; should[…]
Check message with https://github.com/me-[…]
How to design custom ESP-12E PCB. Typical TCP clie[…]
I use ESP8266 MCUs which query temperature with a […]
Follow US on Twitter and get ESP8266 news and updates first.