gpio_hold_en persists over esp_restart()

jcsbanks
Posts: 248
Joined: Tue Mar 28, 2017 8:03 pm

gpio_hold_en persists over esp_restart()

Postby jcsbanks » Fri Jun 14, 2019 11:21 am

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

ESP_igrr
Posts: 1478
Joined: Tue Dec 01, 2015 8:37 am

Re: gpio_hold_en persists over esp_restart()

Postby ESP_igrr » Fri Jun 14, 2019 10:57 pm

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.

Who is online

Users browsing this forum: Google [Bot] and 24 guests