Page 1 of 1

gpio_hold_en persists over esp_restart()

Posted: Fri Jun 14, 2019 11:21 am
by jcsbanks
Reviewing earlier threads, it seemed that esp_restart() also now resets the hardware, but if I go to light sleep with pad holds and then restart, peripherals using these pins (eg LED and CAN bus) are not able to work. Unless I gpio_hold_dis() before esp_restart(). Or of course if I power cycle.

I don't mind doing this, but the esp_restart() is a lazy way to ensure everything is properly reset and cleared out, and it makes me wonder if there are other things I need to do to before esp_restart() to have a restart like a power cycle.

esp-idf 3.3 beta 2

Re: gpio_hold_en persists over esp_restart()

Posted: Fri Jun 14, 2019 10:57 pm
by ESP_igrr
esp_restart intentionally doesn't touch many bits of hardware. In applications such as light bulbs, even if the program crashes it is still expected that the light should not flicker. GPIOs are also not reconfigured.
esp_restart only resets peripherals which may be doing DMA into RAM, to ensure that DMA process doesn't keep writing to memory after the CPU is reset. Then it resets the CPU.

The closest to a power-on reset is an RTC watchdog reset. Like power-on reset, RTC watchdog resets all the digital and RTC peripherals.