loboris / MicroPython_ESP32_psRAM_LoBo

MicroPython for ESP32 with psRAM support
Other
825 stars 341 forks source link

Guru meditation in wifi_os_adapter.c:? #223

Open ubIQio opened 5 years ago

ubIQio commented 5 years ago

Using latest build I have a system publishing sensor data every second to MQTT broker. After 3-4 days running am getting

Guru Meditation Error: Core  0 panic'ed (Interrupt wdt timeout on CPU0)
Core 0 register dump:
PC      : 0x40092890  PS      : 0x00060834  A0      : 0x80090922  A1      : 0x3ffca0a0
A2      : 0x3ffc8d78  A3      : 0x3ffbf600  A4      : 0x3ffbf5e4  A5      : 0x00000001
A6      : 0x000000fe  A7      : 0x00060023  A8      : 0x3ffbf600  A9      : 0x00000002
A10     : 0x3ffbf600  A11     : 0x00000002  A12     : 0x3f406bd5  A13     : 0x3f406853
A14     : 0x000000fe  A15     : 0x00000000  SAR     : 0x00000019  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x40098d50  LEND    : 0x40098d7e  LCOUNT  : 0xffffffff
Backtrace: 0x40092890:0x3ffca0a0 0x4009091f:0x3ffca0c0 0x4008f49f:0x3ffca0e0 0x40088162:0x3ffca120 0x4008afb5:0x3ffca140
Core 1 register dump:
PC      : 0x4008ecd9  PS      : 0x00060034  A0      : 0x8008fa3c  A1      : 0x3ffc0060
A2      : 0x3ffb24c8  A3      : 0x00060023  A4      : 0x0000cdcd  A5      : 0x0000abab
A6      : 0x3ffb2018  A7      : 0x00000001  A8      : 0x0000cdcd  A9      : 0xb33fffff
A10     : 0x00000003  A11     : 0x00060023  A12     : 0x800905df  A13     : 0x3ffb1fa0
A14     : 0x00000020  A15     : 0x00000020  SAR     : 0x00000011  EXCCAUSE: 0x00000005
EXCVADDR: 0x00000000  LBEG    : 0x00000000  LEND    : 0x00000000  LCOUNT  : 0x00000000
Backtrace: 0x4008ecd9:0x3ffc0060 0x4008fa39:0x3ffc0090 0x400916e0:0x3ffc00c0 0x40091696:0x400d4a00
CPU halted.

EspStackTraceDecoder seems to point to wifi_os_adapter.c

Core1

PC: 0x4008ecd9: vPortCPUAcquireMutex at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/portmux_impl.inc.h line 105
EXCVADDR: 0x00000000
Decoding stack results
0x4008ecd9: vPortCPUAcquireMutex at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/portmux_impl.inc.h line 105
0x4008fa39: vTaskSwitchContext at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/tasks.c line 2846
0x400d4a00: task_wdt_isr at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/esp32/task_wdt.c line 156

Core0

0x40092890: vListInsert at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/list.c:204
0x40098d50: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:181
0x40098d7e: memcpy at /home/jeroen/esp8266/esp32/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/machine/xtensa/../../../../.././newlib/libc/machine/xtensa/memcpy.S:214
0x40092890: vListInsert at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/list.c:204
0x4009091f: vTaskPlaceOnEventList at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/tasks.c:4740
0x4008f49f: xQueueGenericReceive at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/freertos/queue.c:1995
0x40088162: semphr_take_wrapper at /Users/jep/github/FlowSensorESP/Tools/esp-idf/components/esp32/wifi_os_adapter.c:236
0x4008afb5: ppTask at ??:?

Was wondering if anyone else experiencing network instability or if have ideas how I can find the root cause?

loboris commented 5 years ago

It is hard to diagnose the errors occuring after such long run periods.

As the error is Interrupt wdt timeout you may try to increase the interrupt watchdog timeout (→ Component config → ESP32-specific → Interrupt watchdog timeout (ms)) from default 300 ms to some larger value. You can also set Panic handler behaviour to Silent reboot (→ Component config → ESP32-specific → Panic handler behaviour). That way your system will be restarted on error and continue to operate. If configured to handle restarts in a correct way, it will only be a couple of seconds interrupt in operation...

yeyeto2788 commented 5 years ago

@loboris is there a way to debug such errors? on issue #151 it also raises a Guru Meditation error but it seems not be related to wifi. Using this Micropython port and a wrapper of the display module give the error.

loboris commented 5 years ago

Critical errors always begins with Guru Meditation Error, the text in parenthesis describes the error. If the error is from Core 0, it is probable related to the code in some esp-idf function, if it is from Core 1, it may be related to the code executed from some Python function. I would recommend to run your application from esp-idf monitor (./BUILD.sh monitor), that way, if error occurs, the log trace to all executed functions will be printed and it should be easier to determine the error source. You can get more informations on fatal errors here. Sometimes the crashes may be caused by inadequate power supply. Make shure your primary power supply, power wiring and the on board voltage regulator (LDO) can all provide at least 500 mA of current if using WiFi.