ESP32-C3 - Double use for RST button

456h7H
Posts: 2
Joined: Sat Apr 29, 2023 11:57 pm

ESP32-C3 - Double use for RST button

Postby 456h7H » Sun Apr 30, 2023 12:01 am

Hi forum,

I have an esp32-c3-wroom-02 based board with 2 buttons, one for boot loader and one for reset. I'm able to put my controller into download mode to upload my code by pressing the RST button while pressing the boot button.

This works fine. However, I need to be able to associate a piece of code to the RST press. Seeing as the RST is part of the controller logic, a single press will restart the controller. I was wondering if maybe I could detect a long press and associate a function with it.

Any idea if this is possible?

ESP_Sprite
Posts: 9727
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-C3 - Double use for RST button

Postby ESP_Sprite » Sun Apr 30, 2023 1:39 am

Not in code. The ESP32 is entirely halted in reset state during the time that RST is pressed, so there's no way to detect a long press in software. Best you could potentially do is add an external RC circuit to another GPIO, with the C only discharging entirely in a long press, and use that GPIO to detect that in sofware. Alternatively, the BOOT button is connected to GPIO9 and functions as a normal button after boot, so you're free to use that for whatever function.

456h7H
Posts: 2
Joined: Sat Apr 29, 2023 11:57 pm

Re: ESP32-C3 - Double use for RST button

Postby 456h7H » Mon May 01, 2023 1:07 am

Thank you so much ESP_Sprite! That just saved me a lot of work! Thank you!

Who is online

Users browsing this forum: No registered users and 59 guests