I’m having a strange issue with ESP8266 deep sleep and I’m running out of ideas.
Problem:
The ESP8266 goes to deep sleep correctly, wakes up (reset happens), but after waking up it does not seem to execute my code properly. I only see the boot messages, but none of my Serial.println() outputs.
What I observe:
After wake-up I get:
rst cause:2
boot mode:(3,6)
This indicates the reset from deep sleep is happening.
However, after that, my code does not appear to run (no Serial output, no LED activity beyond initial test).
There is a pinned post in every category called 'How to get the best from the forum'.
We are not sitting beside you, so we cannot see what you see.
Congrats on using code tags to post the code, but if you do an Auto Format (CMD/CTL-T) and remove most of the unneeded vertical white space, it would be even better.
I don't know if it's the same problem, but a while back there was an issue with clone Lolin D1 Mini boards, which also use the ESP8266, being unable to wake up from deep sleep:
The problem involved the 8-pin serial flash chip, and the fix was either to replace the chip with a Winbond, or jumper two points with a resistor.
Edit: It does appear to be the same problem. And if so, the fix would be a 10K pullup resistor (to 3.3V) to physical pin 2 of the serial flash chip. But on the NodeMCU, that flash chip may be under the metal shield.
Edit2: Google AI says:
SDD0/GPIO7 Pull-up Resistor: Some ESP8266 modules (like certain
AZ-Delivery or AI-Thinker boards) have issues with the flash memory
state after sleep. Soldering a 10k resistor between the 3.3V pin
and the SDD0 (GPIO7) pin can solve this issue.
Might be worth a try if you can find GPIO7. Unlikely to harm anything, and it either solves the problem or it doesn't.