Page 1 of 3

WDT timeout in bootloader for ESP32s2

Posted: Mon Jan 04, 2021 1:40 pm
by william.ferguson.au
My app is aborting and rebooting after only 1251 millis.

If I modify the app even slightly (eg adding a log line that is never called) then it starts working again at least until some other arbitrary code modification causes it to stop working.

When it aborts it doesn't provide any info, just stops logging and starts over with:

Code: Select all

ESP-ROM:esp32s2-rc4-20191025
Build:Oct 25 2019
rst:0x8 (TG1WDT_SYS_RST),boot:0x8 (SPI_FAST_FLASH_BOOT)
Saved PC:0x40334a69
SPIWP:0xee
mode:DIO, clock div:2
load:0x3ffe6100,len:0x8
load:0x3ffe6108,len:0x1814
load:0x4004c000,len:0x9d8
load:0x40050000,len:0x2e34
entry 0x4004c1ec
I (51) boot: ESP-IDF v4.3-dev-1904-gbaef16f9f-dirty 2nd stage bootloader
I (51) boot: compile time 11:29:41
I (51) boot: chip revision: 0
I (55) boot.esp32s2: SPI Speed      : 40MHz
I (60) boot.esp32s2: SPI Mode       : DIO
I (64) boot.esp32s2: SPI Flash Size : 4MB
W (69) boot.esp32s2: PRO CPU has been reset by WDT.
W (75) boot.esp32s2: WDT reset info: PRO CPU PC=0x4004c3ee

The only clues I can see is the last 2 lines of log above where it indicates that the CPU was reset by the WatchDog. But the address it gives 0x4004c3ee points to bootloader code:

Code: Select all

xtensa-esp32s2-elf-addr2line -pfiaC -e build/bootloader/bootloader.elf 0x4004c3ee

0x4004c3ee: wdt_reset_info_dump at E:/Dev/Espressif/esp-idf/components/bootloader_support/src/esp32s2/bootloader_esp32s2.c:240
 (inlined by) bootloader_check_wdt_reset at E:/Dev/Espressif/esp-idf/components/bootloader_support/src/esp32s2/bootloader_esp32s2.c:276
 (inlined by) bootloader_init at E:/Dev/Espressif/esp-idf/components/bootloader_support/src/esp32s2/bootloader_esp32s2.c:326
Note that commenting out code till it starts working isn't a helpful suggestion since *any* code change causes it to start working again.

I'm looking for any clues as to what is occurring.

Re: WDT timeout in bootloader for ESP32s2

Posted: Wed Jan 06, 2021 6:36 am
by william.ferguson.au
Anyone?

Re: WDT timeout in bootloader for ESP32s2

Posted: Wed Jan 06, 2021 9:36 am
by ESP_Sprite
No clue... does your code do the same thing in another ESP32S2 board? Can you put the offending code somewhere?

Re: WDT timeout in bootloader for ESP32s2

Posted: Wed Jan 06, 2021 7:17 pm
by Mohitvermaji51
I am enabling watchdog in bootloader image(it must required as. ... be ON so after timeout of watchdog time its getting reset in between of downloading flash.

Re: WDT timeout in bootloader for ESP32s2

Posted: Wed Jan 06, 2021 8:29 pm
by william.ferguson.au
@ESP_sprite - yes the code does the same thing on another ESP32S2
No, I can't easily put the code anywhere.

@Mohitvermaji51- sorry I don't understand your comment.

Re: WDT timeout in bootloader for ESP32s2

Posted: Thu Jan 07, 2021 9:50 am
by ESP_Minatel
Hi,

Can you share your Bootloader config section?

It looks like the configuration below?
Screenshot from 2021-01-07 09-37-17.png
Screenshot from 2021-01-07 09-37-17.png (58.82 KiB) Viewed 8189 times

Re: WDT timeout in bootloader for ESP32s2

Posted: Thu Jan 07, 2021 10:38 pm
by william.ferguson.au
Looks like its the same as yours.

Image

Re: WDT timeout in bootloader for ESP32s2

Posted: Thu Jan 07, 2021 10:41 pm
by william.ferguson.au
OK, image doesn't seem to be showing for me. So trying again.
Image

Re: WDT timeout in bootloader for ESP32s2

Posted: Thu Jan 07, 2021 10:43 pm
by william.ferguson.au
OK that didn't work either.
Suggestions on pasting an image?
In any case, it's a replica of the one that you posted.

Re: WDT timeout in bootloader for ESP32s2

Posted: Thu Jan 07, 2021 11:18 pm
by ESP_Angus
Hi william,

Just to check some details: before the WDT reset (which is shown in the log), your app is definitely running for approx 1.2 seconds? You see some additional boot log output from the app, app_main() starts running, etc. Is that right?

Is it correct to say that the log output indicates it's not actually crashing in the bootloader, apart from that the address in the subsequent boot seems to show a WDT address?

After it prints the line "boot.esp32s2: WDT reset info: PRO CPU PC=0x4004c3ee", what happens? Does it immediately reset again? Or does it start the app, start running for approx 1.2 seconds, then reset itself again? If you have an extended log that shows a few boot loops, this might be useful (feel free to scrub any sensitive app-specific details.)

Address 0x4004c3ee is a bootloader address but also an app IRAM address (this part of the bootloader is overwritten during the boot process). Do you see anything meaningful at this address in the app?

Finally, what ESP-IDF version are you using?

Thanks.