1
\$\begingroup\$

I try to entirely rephrase my problem.

On the ESP8266, the RST pin is always HIGH (+3.3V), and you need to put it dow to 0-1V to reset the chip.

I will plug two push buttons on the reset pin, "button red" and "button green". My objective is to know which button has been pressed to reset the ESP.

The overall idea is to put a Resistor-Capacitor circuit on the green button. When green button is pushed, I will measure a low voltage if t=RC is high enough. If the red button is pressed, then I will measure a high voltage.

The schema with only the green button is:

schematic

simulate this circuit – Schematic created using CircuitLab

Sorry I don't know how to draw it, I insert an image of the voltages when green is pushed then released:

enter image description here

Then I need to plug the red button so the U(RC) stays high when pushed, but U(reset_pin) still a "rectangle".

enter image description here

Is this schema the right thing to do:

schematic

simulate this circuit

I cannot test the circuit right now, but is it OK in theory?

And am I in the right direction, or am I missing a trivial solution?

asked Oct 6, 2015 at 11:23
\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Answer found. I was leading in the wrong direction with the RC circuit.

Here is the right schema to some my problem:

enter image description here

With this schema, I need to ALWAYS set the GPIO4 to HIGH before the init. Then if GPIO4 is HIGH at startup, it is a natural wake up. And if it is LOW, it is a user triggered wake up.

answered Oct 8, 2015 at 9:38
\$\endgroup\$
0
\$\begingroup\$

The typical way to handle this in code is by having your loop function come after a proper init function. Pseudo Code:

Boot Init();
 While(1){
 Looped Init();
 Sleep();
 Awake();
 Loop to While();
 }

As long as the reset is a proper reset, the microprocessor should start from the very beginning, not just come out of sleep and continue in the loop. Boot Init should only run the first time the MCU is powered, unless reset.

answered Oct 6, 2015 at 13:36
\$\endgroup\$
2
  • \$\begingroup\$ Understood, but your solution is incmpatible with a deep sleep mode. And deep sleep mode is a requirement for me as I have to run on batteries. \$\endgroup\$ Commented Oct 6, 2015 at 14:38
  • \$\begingroup\$ See my tottaly reformulated question \$\endgroup\$ Commented Oct 8, 2015 at 7:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.