NodeMCU reseting after 6 hours

Discussion in 'Embedded Systems and Microcontrollers' started by ddads, Nov 13, 2017.

  1. ddads

    Thread Starter New Member

    Nov 13, 2017
    5
    0
    Hi,
    I'm in a project with my nodemcu (ESP-12), it has 3 sensor (a DHT-22, a MQ-2 and a k thermocouple) and a spi oled display. Every minute it reads the sensors and sends to a server.
    It works fine, however every 6h 25min(+/-) it resets without any apparently reason.
    I have some error messages:

    Exception (29):
    epc1=0x4000e1b2 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

    ctx: sys
    sp: 3ffffda0 end: 3fffffb0 offset: 01a0

    >>>stack>>>
    3fffff40: 3fffdcc0 000002f4 3ffee190 401004f4
    3fffff50: 4023f62b 00000a46 3ffee190 40107278
    3fffff60: 3ffe9f48 00000008 00000a46 40217dc6
    3fffff70: 40218200 65c871e8 40218263 000000af
    3fffff80: 40218ad7 40218bae 60000600 3ffee190
    3fffff90: 3fffdcc0 00000000 40000f65 3fffdab0
    3fffffa0: 00000000 0000172a 3fffdab0 40000f49
    <<<stack<<<

    ets Jan 8 2013,rst cause:2, boot mode:(3,7)

    load 0x4010f000, len 1384, room 16
    tail 8
    chksum 0x2d
    csum 0x2d
    v09f0c112
    ~ld
    ø

    >>>>> Here is the stack decoded: <<<<<

    0x401004f4: calloc at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1684
    0x4023f62b: pm_set_sleep_mode at ?? line ?
    0x40107278: pvPortZalloc at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
    0x40217dc6: pm_set_sleep_time at ?? line ?
    0x40218200: pm_get_sleep_type at ?? line ?
    0x40218263: pm_get_sleep_type at ?? line ?
    0x40218ad7: LightSleepWakedCbSetFunc at ?? line ?
    0x40218bae: LightSleepWakedCbSetFunc at ?? line ?

    Sometimes it gives me other stacks, the decoded lines are below:

    0x401004f4: calloc at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1684
    0x40105942: ets_timer_setfn at ?? line ?
    0x40107278: pvPortZalloc at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
    0x40105886: wdt_feed at ?? line ?
    0x40217dc6: pm_set_sleep_time at ?? line ?
    0x40229a1c: ets_timer_handler_isr at ?? line ?
    0x40218286: pm_get_sleep_type at ?? line ?
    0x40229a42: ets_timer_handler_isr at ?? line ?
    0x4021947f: pm_post at ?? line ?
    0x4020e58b: loop_task at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56

    and

    0x401004f4: calloc at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266\umm_malloc/umm_malloc.c line 1684
    0x40107278: pvPortZalloc at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/heap.c line 33
    0x40217dc6: pm_set_sleep_time at ?? line ?
    0x40105b14: ets_timer_arm_new at ?? line ?
    0x40218286: pm_get_sleep_type at ?? line ?
    0x40218333: pm_get_sleep_type at ?? line ?
    0x40218248: pm_get_sleep_type at ?? line ?
    0x40201018: delay_end at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_wiring.c line 40
    0x402299fd: ets_timer_handler_isr at ?? line ?
    0x40229a42: ets_timer_handler_isr at ?? line ?
    0x4020e58b: loop_task at C:\Users\ddadsx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/core_esp8266_main.cpp line 56

    -------------------------------
    I'm sorry about the long post.
     
  2. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,634
    1,969
    I'm no programmer, but what does that '2' tell you about the reset cause?
     
  3. ddads

    Thread Starter New Member

    Nov 13, 2017
    5
    0
    rst cause:2, boot mode:(3,7) means that the reset cause was the reset pin and the boot mode is the normal flash startup (according to the documentation http://www.esp8266.com/viewtopic.php?p=2096#p2112).
    But the reset cause isn't right because I place a pullup resistor between the rst pin and Vcc (It's active when low).
    The strange part is the frequency of the resets, every 6,5h.
     
  4. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    8,634
    1,969
    That may not be enough if there's a noise spike/dip on the Vcc rail.
     
  5. ddads

    Thread Starter New Member

    Nov 13, 2017
    5
    0
    There is a physical button connected to this pin as well, and even if I click it, it doesn't restart because of the pullup resistor.
    Although if I take the resistor out, the button works normally.
     
  6. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,689
    332
    That really don't help much without your code.
     
  7. RichardO

    Senior Member

    May 4, 2013
    2,274
    886
    And a sketch of how your pullup and switch are connected.
     
  8. moffy

    New Member

    Nov 13, 2017
    11
    0
    Calloc seems to be common to your stacks. Do you have a memory leak/corruption? Running out of stack or global memory space.
     
  9. be80be

    AAC Fanatic!

    Jul 5, 2008
    1,689
    332
    It's probably millis () but without code no way to tell.
     
Loading...