Debugging ESP32 resets

Oromis
Posts: 21
Joined: Mon Sep 25, 2017 1:44 pm

Debugging ESP32 resets

Postby Oromis » Wed Jan 17, 2018 10:13 am

Hi,

I ran into a problem with my ESP32 project. I use the ESP32 to control a piece of external hardware (an inverter), which works really well. Unfortunately, the chip resets itself after a few hours. This is the only thing I see in the logs after the reset:

Code: Select all

ets Jun  8 2016 00:22:57

rst:0x8 (TG1WDT_SYS_RESET),boot:0x17 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5572
load:0x40078000,len:0
load:0x40078000,len:13724
entry 0x40078fb4
W (85) boot: PRO CPU has been reset by WDT.
W (85) boot: WDT reset info: PRO CPU PC=0x400818bb
W (86) boot: WDT reset info: APP CPU PC=0x400816de
I (92) boot: ESP-IDF v3.0-rc1-121-g309fb23-dirty 2nd stage bootloader
I (99) boot: compile time 09:09:29
I (103) boot: Enabling RNG early entropy source...
I (108) boot: SPI Speed      : 40MHz
I (113) boot: SPI Mode       : DIO
I (117) boot: SPI Flash Size : 4MB
I (121) boot: Partition Table:
I (124) boot: ## Label            Usage          Type ST Offset   Length
I (132) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (139) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (147) boot:  2 factory          factory app      00 00 00010000 00100000
I (155) boot: End of partition table
Apparently, the watchdog caused the chip reset. But that's it, it doesn't give me any more info. How can I debug which task / function failed to feed the watchdog? The log mentions

Code: Select all

WDT reset info
with the location of the CPUs' program counter registers. Is there any way to find out which section of my code this register was pointing to at the time of the reset?

Thank you very much for any suggestions!

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

Re: Debugging ESP32 resets

Postby ESP_Sprite » Thu Jan 18, 2018 2:18 am

You can use xtensa-esp32-elf-addr2line to look up the line for that PC. Alternatively, if you use `make monitor` as a terminal, it'll do that for you as soon as the address scrolls by.

Oromis
Posts: 21
Joined: Mon Sep 25, 2017 1:44 pm

Re: Debugging ESP32 resets

Postby Oromis » Thu Jan 18, 2018 9:42 am

Thanks a lot, xtensa-esp32-elf-addr2line did the trick! I didn't know about this tool until now.

Who is online

Users browsing this forum: No registered users and 102 guests