-->
Page 2 of 3

Re: How to know if I got "naturaly" off deep sleep

PostPosted: Thu Oct 08, 2015 2:45 am
by Vincent Lê
Whaoo, thank you very much.

In the same time, I had rephrased my situation @stackexchange: http://electronics.stackexchange.com/qu ... ally-reset

Just one thing: do you have in mind that RST pin should be triggered DOWN? In your circuits, it is linked to Vcc when button is pushed.

I will try your solutions as soon as possible and keep you posted!!

Re: How to know if I got "naturaly" off deep sleep

PostPosted: Thu Oct 08, 2015 4:34 am
by Vincent Lê
Heeee haaaa!!!! Solved it! (ager 2 full days going crazy)

And the correct answer is the image attached.

I was working in the wrong direction, and your solution with a dual pole switch made me go in the right direction.

I don't need any RC circuit. i was lacking some good sense and also gpio behavior.

With my 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.

I am so happy!

Re: How to know if I got "naturaly" off deep sleep

PostPosted: Thu Oct 08, 2015 11:15 am
by jankop
It is unnecessarily complicated. Just manually perform a power cycle or use the diagram in Fig.
Function node.bootreason() for power on reset has code 1 and for reset has code 2. It is all.

Re: How to know if I got "naturaly" off deep sleep

PostPosted: Fri Oct 09, 2015 2:36 am
by Vincent Lê
This is a very elegant way of doing it, I love it. I didn't know this function since it is not in the API doc (https://github.com/nodemcu/nodemcu-firmware/wiki/nodemcu_api_en)!

But it is here in the master branch, so I am going to use it. (just a bit frustrated having 2 days spent on this problem, but hey, what did I expect)

One last question: why do you put a resistor between CHIP_PD and VCC ? For the deepsleep function I linked GPIO16 and RST, do I have to also add a resistor?