We are getting some odd results restarting the ESP 32 after an OTA.
It seems like some peripherals are not reset (wifi, ble, spi, uart etc as described in the docs)
However, sometimes after an OTA erasing flash sectors appears to not work (about 50 % of the time erase returns success but reading the data shows it doesn't go to 0xFFs).
Pressing reset or powering down and back up make it function normally.
Is there a more forceful way to reset then esp_restart() that resets peripherals?
What might be related is if erase works we almost always get one rtc watch dog timer reset after the OTA completes and the new firmware has been running for 1-2 minutes then it runs fine.
Thanks
ESP 32 Restart
Re: ESP 32 Restart
I am going to try something like the following...ill update if it works
Code: Select all
system_reset()
{
rtc_wdt_protect_off();
rtc_wdt_set_stage(RTC_WDT_STAGE0, RTC_WDT_STAGE_ACTION_RESET_SYSTEM);
rtc_wdt_set_time(RTC_WDT_STAGE0, 100);
rtc_wdt_enable();
rtc_wdt_protect_on();
}
Re: ESP 32 Restart
For those that stumble on this same issue, the above solution worked (we increased the timeout, set a global reset pending flag so other threads knew not to start doing things like write to flash (or feed the rtc), added a vtaskdelay to give other tasks time to complete, and then put the thread priority to max and stuck it in a while loop till the timer expired).