Detect powering up or resetting state

bagunceiro
Posts: 5
Joined: Thu Aug 10, 2023 3:06 pm

Detect powering up or resetting state

Postby bagunceiro » Thu Aug 10, 2023 3:20 pm

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

MicroController
Posts: 1735
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Detect powering up or resetting state

Postby MicroController » Fri Aug 11, 2023 11:51 am

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.

bagunceiro
Posts: 5
Joined: Thu Aug 10, 2023 3:06 pm

Re: Detect powering up or resetting state

Postby bagunceiro » Fri Aug 11, 2023 6:14 pm

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 ;-)

MicroController
Posts: 1735
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Detect powering up or resetting state

Postby MicroController » Sat Aug 12, 2023 3:59 pm

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.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 54 guests