Page 1 of 1

ESP.restart() does't trigger complete boot after Update()

Posted: Mon Jan 03, 2022 1:34 am
by marchingband
I have some code that runs Update() from data stored in eMMC. The process works great, but the call to ESP.Restart() doesn't cause a successful boot. Resetting the ESP32 after this, the new firmware boots perfectly.

  1.     if(Update.end()){
  2.         if(Update.isFinished()){
  3.             sdmmc_host_deinit();
  4.             delay(1000);
  5.             ESP.restart();
  6.         } else {
  7.             log_e("Update.isFinished() : false");
  8.         }
  9.     } else {
  10.         log_e("Update.end() : false");
  11.     }

Verbose log:

rst:0xc (SW_CPU_RESET),boot:0x3f (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:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4


Then the boot process freezes at "entry 0x400806b4".
Any idea how I can get the boot process to complete, without having to manually restart using the reset button or cycling the power?
Thanks!

Re: ESP.restart() does't trigger complete boot after Update()

Posted: Tue Jan 04, 2022 2:38 am
by marchingband
Does anyone have any ideas how I could debug this event better?

Re: ESP.restart() does't trigger complete boot after Update()

Posted: Tue Jan 04, 2022 9:58 pm
by marchingband
I am using an ESP32 WROVER-B module on a custom PCB.
Does this look like it could be a power issue?

Re: ESP.restart() does't trigger complete boot after Update()

Posted: Tue Jan 04, 2022 10:37 pm
by WiFive

Code: Select all

boot:0x3f (SPI_FAST_FLASH_BOOT)
Do you have flash voltage set to 3.3v in efuse?

Re: ESP.restart() does't trigger complete boot after Update()

Posted: Wed Jan 05, 2022 1:04 am
by marchingband
yes i burned the fuses for 3.3v flash.
I have the 16MB flash version of the WROVER-B.

Re: ESP.restart() does't trigger complete boot after Update()

Posted: Wed Jan 05, 2022 9:07 am
by ullixesp
I had my own share of confusion and problems around the ESP.restart() and ended up using a watchdog timer forced reset to trigger a full ESP32 reset. Solved all my problems.

Code: Select all

// needed for the forced reset
#include <esp_int_wdt.h>
#include <esp_task_wdt.h>

void forcedReset(){
// use the watchdog timer to do a hard restart
// It sets the wdt to 1 second, adds the current process and then starts an
// infinite loop.
  esp_task_wdt_init(1, true);
  esp_task_wdt_add(NULL);
  while(true);  // wait for watchdog timer to be triggered
}

Re: ESP.restart() does't trigger complete boot after Update()

Posted: Sat Jan 08, 2022 1:03 am
by marchingband
Amazing, thanks so much @ullixesp, I will try this out!