Reading Exception Information
ESP.getResetReason()
ESP.getResetInfo()
ESP.getFreeSketchSpace()
ESP.getFreeHeap()
ESP.getHeapFragmentation()
ESP.getMaxFreeBlockSize()
Simulating Fatal Exceptions
The following code will generate an exception:
void setup() { Serial.begin(115200); Serial.println(); Serial.println("Let's provoke the s/w wdt firing..."); // // provoke an OOM, will be recorded as the last occured one char* out_of_memory_failure = (char*)malloc(1000000); // // wait for s/w wdt in infinite loop below while(true); // Serial.println("This line will not ever print out"); } void loop(){}
Exceptions
EXC-CAUSE CODE | CAUSE NAME | CAUSE DESCRIPTION | REQUIRED OPTION | EXC-VADDR LOADED |
---|---|---|---|---|
0 | IllegalInstructionCause | Illegal instruction | Exception | No |
1 | SyscallCause | SYSCALL instruction | Exception | No |
2 | InstructionFetchErrorCause | Processor internal physical address or data error during instruction fetch | Exception | Yes |
3 | LoadStoreErrorCause | Processor internal physical address or data error during load or store | Exception | Yes |
4 | Level1InterruptCause | Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register | Interrupt | No |
5 | AllocaCause | MOVSP instruction, if caller�s registers are not in the register file | Windowed Register | No |
6 | IntegerDivideByZeroCause | QUOS, QUOU, REMS, or REMU divisor operand is zero | 32-bit Integer Divide | No |
7 | Reserved for Tensilica | |||
8 | PrivilegedCause | Attempt to execute a privileged operation when CRING ? 0 | MMU | No |
9 | LoadStoreAlignmentCause | Load or store to an unaligned address | Unaligned Exception | Yes |
10..11 | Reserved for Tensilica | |||
12 | InstrPIFDataErrorCause | PIF data error during instruction fetch | Processor Interface | Yes |
13 | LoadStorePIFDataErrorCause | Synchronous PIF data error during LoadStore access | Processor Interface | Yes |
14 | InstrPIFAddrErrorCause | PIF address error during instruction fetch | Processor Interface | Yes |
15 | LoadStorePIFAddrErrorCause | Synchronous PIF address error during LoadStore access | Processor Interface | Yes |
16 | InstTLBMissCause | Error during Instruction TLB refill | MMU | Yes |
17 | InstTLBMultiHitCause | Multiple instruction TLB entries matched | MMU | Yes |
18 | InstFetchPrivilegeCause | An instruction fetch referenced a virtual address at a ring level less than CRING | MMU | Yes |
19 | Reserved for Tensilica | |||
20 | InstFetchProhibitedCause | An instruction fetch referenced a page mapped with an attribute that does not permit instruction fetch | Region Protection or MMU | Yes |
21..23 | Reserved for Tensilica | |||
24 | LoadStoreTLBMissCause | Error during TLB refill for a load or store | MMU | Yes |
25 | LoadStoreTLBMultiHitCause | Multiple TLB entries matched for a load or store | MMU | Yes |
26 | LoadStorePrivilegeCause | A load or store referenced a virtual address at a ring level less than CRING | MMU | Yes |
27 | Reserved for Tensilica | |||
28 | LoadProhibitedCause | A load referenced a page mapped with an attribute that does not permit loads | Region Protection or MMU | Yes |
29 | StoreProhibitedCause | A store referenced a page mapped with an attribute that does not permit stores | Region Protection or MMU | Yes |
30..31 | Reserved for Tensilica | |||
32..39 | CoprocessornDisabled | Coprocessor n instruction when cpn disabled. n varies 0..7 as the cause varies 32..39 | Coprocessor | No |
40..63 | Reserved |
Beerfridge Exception
resetInfo | Fatal exception:4 flag:3 (SOFT_WDT) epc1:0x4000dd11 epc2:0x00000000 epc3:0x00000000 excvaddr:0x00000000 depc:0x00000000 |
resetReason | Software Watchdog |
updateWebVars -complete performTimeSync - start Soft WDT reset >>>stack>>> ctx: cont sp: 3ffffd40 end: 3fffffc0 offset: 01b0 3ffffef0: 00000050 00000017 3fff1ebc 4021358c 3fffff00: 8ebaaba0 00418937 2a3f724a 3fff2000 3fffff10: 8ebaaba0 00000000 00418937 00000000 3fffff20: 3ffea226 3fff2000 40100e9a 8ebaaba0 3fffff30: 00000007 00000064 00000064 40216c37 3fffff40: 01ef43a4 3fff6acc 3fff6ad4 40206b32 3fffff50: 00000007 00000014 00000007 01ef2f84 3fffff60: 3fffdad0 3fff19c4 3fff6acc 40206c54 3fffff70: 3fffdad0 00000000 3fff18c4 402039fe 3fffff80: 3fffdad0 00000000 3fff18c4 40205240 3fffff90: 00000000 00000000 3fff1fd0 40202a71 3fffffa0: 3fffdad0 00000000 3fff1fd0 40215ec4 3fffffb0: feefeffe feefeffe 3ffe8594 40101475 <<<stack<<< ets Jan 8 2013,rst cause:1, boot mode:(3,7) load 0x4010f000, len 1384, room 16 tail 8 chksum 0x2d csum 0x2d v8b899c12 ~ld
Reference
Reference | URL |
---|---|
ESP8266 Fatal exception and Wdt Reset | https://circuits4you.com/2017/12/19/esp8266-fatal-exception-wdt-reset/ |
ESP8266 Reset Causes and Common Fatal Exception Causes | https://www.espressif.com/sites/default/files/documentation/esp8266_reset_causes_and_common_fatal_exception_causes_en.pdf |
My ESP crashes running some code. How to troubleshoot it? | https://arduino-esp8266.readthedocs.io/en/latest/faq/a02-my-esp-crashes.html |
Arduino ESP8266/ESP32 Exception Stack Trace Decoder | https://github.com/me-no-dev/EspExceptionDecoder#installation |
ESP8266 Watchdogs in Arduino *** | https://www.sigmdel.ca/michel/program/esp8266/arduino/watchdogs_en.html#ESP8266_HW_WDT |