32KHz RTC Clock caused Code 1 Panic

jnickel
Posts: 1
Joined: Wed Dec 20, 2017 4:14 pm

32KHz RTC Clock caused Code 1 Panic

Postby jnickel » Thu Dec 21, 2017 4:50 pm

I'm using a Sparkfun ESP32 Thing card, with the IDF toolchain. My project requires the system to wake from sleep on a schedule, and I was seeing a lot of clock drift. The RTC clock by default was the 150KHz clock, but the Sparkfun card has the 32KHz crystal so I ran 'make menuconfig' and configured it to use the 32K crystal.

It booted up fine and was running, but when the system goes to sleep I'm getting a 'Core 1 panic'ed' (IntegerDivideByZero). More than likely it's something I haven't done, (only a month with the card so far).

Coming from Arduino, I'm so impressed with the ESP32. It's incredibly easy to use and very forgiving, the ability to get useful feedback (like the stack trace below) makes tracking down these issues much easier.

Thanks in advance for any pointers.

=================== Panic Stack Trace ======================

Code: Select all

[size=85]Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero)
. Exception was unhandled.
Register dump:
PC      : 0x4012e67d  PS      : 0x00060a30  A0      : 0x8008f7d9  A1      : 0x3ffc9e10  
0x4012e67d: __udivmoddi4 at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libgcc/libgcc2.c:1088
 (inlined by) __udivdi3 at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libgcc/libgcc2.c:1288

A2      : 0x96000000  A3      : 0xffffc759  A4      : 0x00000000  A5      : 0x00000000  
A6      : 0x00060423  A7      : 0x00000000  A8      : 0x00000000  A9      : 0xffffc759  
A10     : 0xffffc759  A11     : 0x00000001  A12     : 0x96000000  A13     : 0x00000001  
A14     : 0x00060420  A15     : 0x00000000  SAR     : 0x0000000f  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

Backtrace: 0x4012e67d:0x3ffc9e10 0x4008f7d6:0x3ffc9e30 0x40128686:0x3ffc9e50 0x400844bd:0x3ffc9e70 0x40084593:0x3ffc9e90 0x4010a6b7:0x3ffc9eb0 0x4010a706:0x3ffc9f00 0x4010c1ca:0x3ffc9f20 0x4010b6fe:0x3ffc9f40 0x4010a033:0x3ffc9f70 0x4010a10c:0x3ffc9fd0
0x4012e67d: __udivmoddi4 at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libgcc/libgcc2.c:1088
 (inlined by) __udivdi3 at /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libgcc/libgcc2.c:1288

0x4008f7d6: rtc_time_us_to_slowclk at /home/jnickel/src/esp/esp-idf/components/soc/esp32/rtc_time.c:125

0x40128686: timer_wakeup_prepare at /home/jnickel/src/esp/esp-idf/components/esp32/./sleep_modes.c:394

0x400844bd: esp_sleep_start at /home/jnickel/src/esp/esp-idf/components/esp32/./sleep_modes.c:394

0x40084593: esp_deep_sleep_start at /home/jnickel/src/esp/esp-idf/components/esp32/./sleep_modes.c:394

0x4010a6b7: enter_deep_sleep(long) at /home/jnickel/src/feeder/main/./sleep.cpp:46

0x4010a706: schedule_and_begin_sleep() at /home/jnickel/src/feeder/main/./sleep.cpp:24

0x4010c1ca: handle_system_request(Request*, Response*) at /home/jnickel/src/feeder/main/./system-req.cpp:123

0x4010b6fe: handle_cmd_request(char const*, Response*) at /home/jnickel/src/feeder/main/./req-handler.cpp:157

0x4010a033: handle_request(int) at /home/jnickel/src/feeder/main/./req-server.cpp:238

0x4010a10c: request_server_task(void*) at /home/jnickel/src/feeder/main/./req-server.cpp:311


Rebooting...
[/size]

ESP_Sprite
Posts: 9708
Joined: Thu Nov 26, 2015 4:08 am

Re: 32KHz RTC Clock caused Code 1 Panic

Postby ESP_Sprite » Fri Dec 22, 2017 1:28 am

That looks like a bug in the RTC handling code; possibly some kind of value doesn't get updated but is zero and something tries to divide by that... we need to look into this. Could you do us a favour and post this info as an issue on Github so we can track it better?

Who is online

Users browsing this forum: brebisson and 50 guests