Page 1 of 1

Detect powering up or resetting state

Posted: Thu Aug 10, 2023 3:20 pm
by bagunceiro
This post refers to a variable power supply controlled by an ESP-32.

I want to be able to detect in hardware that the processor is not ready, and in response disable the output until the software is up and it takes control by asserting a GPIO. This would mainly be from power up, but ideally also from reset so that it will fail safe.

Are any of the pins reliably set to a known state in these cases?

Thanks

Re: Detect powering up or resetting state

Posted: Fri Aug 11, 2023 11:51 am
by MicroController
See the column "Reset" of table 4-3 in section 4.10 IO_MUX Pad List of the TRM.
All pads enter "input" state, so you can get the "reset" signal level you want via an external pullup/pulldown resistor.

Re: Detect powering up or resetting state

Posted: Fri Aug 11, 2023 6:14 pm
by bagunceiro
No, they don't (probably I wasn't clear enough). I had spent a fait bit of time experimenting with this in the hope that they do.

I want this for fail safe (as well as power up) so I need an indication that a soft reset has ocurred as happens during failure. And I can't find any way to detect this externally. All pins (at least all those I tried) do go to input mode on startup and hard reset, but not on a software reset.

Probably I should just write code that doesn't crash ;-)

Re: Detect powering up or resetting state

Posted: Sat Aug 12, 2023 3:59 pm
by MicroController
Ok, got it :)

Apparently, the ESP32 panic handler normally only does a "soft" reset by calling esp_restart_noos() from panic_restart():

https://github.com/espressif/esp-idf/bl ... ler.c#L232

You could try and modify panic_restart() to unconditionally call esp_restart_noos_dig() instead, which appears to do a system-level reset including the "digital peripherals". - Or just add a line to have a specific GPIO pin switched to "input" before restarting.