ESP8266 deep sleep fails

I have a ESP Pro NodeMcu Lua antenna which operates normally but doesn't deep sleep.


#define led_pin 2

void setup() {
  Serial.begin(9600);         // Start the Serial communication to send messages to the computer
  while (!Serial);            // wait for Serial Monitor to open
  delay(1000);

  pinMode(led_pin, OUTPUT);

  Serial.println("wake up");  
  digitalWrite(led_pin, HIGH);
  delay(2000);
  digitalWrite(led_pin, LOW);
  ESP.deepSleep(6e7); /* Sleep 1 minute*/
//  ESP.deepSleep(5e6); /* Sleep for 5 seconds */
}

void loop() {
}

The first pass through setup() writes correctly to the monitor. After connecting reset pin to D0 nothing shows on the monitor.

This code works fine with other ESPs

I have been using this individual chip to communicate using its NOW wireless facility.

Have just retrieved another identical chip from another project.

Deep sleep fails on this one also.

Is there anything else connected to the board ?

But does the LED light up for 2 seconds ?

Please post a link to where you got it from.

Thanks Deva_Rishi

There is nothing else connected to the board.

Both esps were from Amazon (Binghe Pro with external antenna, ESP Pro NodeMcu Lua WiFi)

On powering up the LED flashes immediately and "⸮)⸮@ssp wake up" is printed to the monitor.

One minute later the LED flashes and "$⸮" is printed to the monitor.

After that nothing happens.

The one-minute flash shows that D0 is successfully waking/resetting the ESP. The garbled text is the ESP8266 boot message, which is transmitted at 74880 baud.

Set the Serial Monitor and Serial.begin() to 74880, remove while (!Serial);, and inspect the complete boot message. Since execution does not reach "wake up" after reset, try reflashing with Flash Mode: DOUT or DIO, as some clone boards fail to boot in QIO mode. Also verify that the 3.3 V supply remains stable during Wi-Fi startup.

This ESP8266 controller project also shows the standard GPIO16-to-RESET deep-sleep arrangement. Since your board resets after one minute, that connection appears to be working; the problem is more likely occurring during the subsequent boot.

So deep sleep is working, but i suspect that the USB to TTL chip on the board is not switching between the baud-rates of the boot message and the sketch baud-rate properly.

That for sure, there is no purpose to this on a board without native USB.

adding a delay(1000); before and after the Serial.begin(); should ensure ample time for the USB to TTL converter to be ready.

To view the boot messages sent by the ESP, set the baud rate of the Serial monitor to 74880 bps

Do you have the same board selected in the IDE?

OK, dropped the while (!Serial);

Set baud rate to 74880

LED flashes once at start then again at 1 minute then nothing.

Nothing showing on the monitor throughout.

Same IDE settings throughout.

Now trying understand "reflashing"

Thanks

I notice that when baud rate is set to 74880 the IDE shows an error:-

Error while setting serial port parameters: 74,880 N 8 1

I'm using a PC based Arduino IDE

Are you sure you have selected the correct COM port ?

I suppose you have but that is just really wierd.

Yes, have been using the same COM port throughout.

Baud rate 9600 shows no error. Could it be a poor quality USB cable? I've been using for ages though.

Shouldn't select the correct board for the board you are using and not the same as the other boards?

Thanks for that.

"Generic ESP8226 Module" has been selected throughout.

In fact I only use ESP8266 devices.

ESP8266 ?

But the nodeMCU does have significantly more flash memory available than the default 512KB

Mind you the parameters that are board specific for the other boards that you can use are also options of the generic 8266, actually only the ESP8285 is in not configurable using generic 8266 as a board choice.

Have tried flash modes DIO, DOUT and QIO(Fast).

Tried several ESP8266 board types in the IDE.

Still deepsleep not functioning.

Have ordered a WEMOS D1 Mini Pro, which will arrive in a couple of days, hopefully this will solve my problem.

The flash modes and (most probably) the board type was nothing to do with deep sleep not working.

Well since i am not convinced deep sleep isn't working, i would propose the following modification of your sketch

#define led_pin 2

void setup() {
  delay(1000);
  Serial.begin(9600);         // Start the Serial communication to send messages to the computer
  delay(1000);
  Serial.println();

  pinMode(led_pin, OUTPUT);

  Serial.println("wake up");
  for (uint8_t i = 0; i < 10; i++) {  
    digitalWrite(led_pin, HIGH);
    delay(200);
    digitalWrite(led_pin, LOW);
    delay(200);
  }
  ESP.deepSleep(6e7); /* Sleep 1 minute*/
//  ESP.deepSleep(5e6); /* Sleep for 5 seconds */
}

void loop() {
}

and in this case you should see the LED flash 10 times on reset/ wakeup

Also please verify the connection between GPIO16 and RST pins using a DMM

I suspect that it is actually the USB to TTL converter that is not re-activating properly.

As stated before, when switching the serial monitor baud-rate to 74880, there should always be a boot message printed on reset/wake-up (stating external reset) and you say that this isn't happening at all.

Probably.

Thanks,

I get 10 flashes with the new sketch on startup then one minute later there is only one flash.

With 74880 baud the monitor shows:-

l⸮⸮|

at first, then at 1 minute more characters are printed on the same line of the monitor. There is no new line with timestamp.

What am I looking for with the DMM?

With D0 linked to RST I measure 3.3V on the RST pin.

That is normal, there is a 10K (or maybe 20K) pullup on the RST pin. (confirm either way by measuring the resistance between RST & Vcc)
what do you measure on D0 ?, that should also be 3.3v.


What i only just now notice is that RST marked on the silk is actually CH_PD, whereas EN is actually connected to Reset (on the ESP8266). Not that it matter much though, but it is a bit odd.

What you want to measure is the continuity between D0 & RST (or EN)

Which indicates that something is happening. That no boot message is printed is strange.

When i press RST on my nodeMCU it shows me

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x40100000, len 2408, room 16 
tail 8
chksum 0xe5
load 0x3ffe8000, len 776, room 0 
tail 8
chksum 0x84
load 0x3ffe8310, len 632, room 0 
tail 8
chksum 0xd8
csum 0xd8

2nd boot version : 1.6
  SPI Speed      : 40MHz
  SPI Mode       : QIO
  SPI Flash Size & Map: 8Mbit(512KB+512KB)
jump to run user1 @ 1000

rf cal sector: 251
rf[112] : 00
rf[113] : 00
rf[114] : 01

SDK ver: 2.0.0(656edbf) compiled @ Jul 19 2016 17:58:40
phy ver: 1055, pp ver: 10.2

When i run the sketch and switch the Serial monitor to 9600bps it shows me

⸮R⸮)⸮Hp⸮<>dhX⸮4C<l⸮4h R⸮⸮h0⸮⸮
wake up
⸮DOz4`LME⸮x⸮E⸮⸮`⸮ :IX⸮iI⸮⸮
wake up
⸮E⸮|vAM⸮t⸮ayɨ⸮t⸮⸮b8
h⸮G⸮4⸮
wake up
HpI<>$h⸮⸮lb<l⸮42h$R⸮⸮i$⸮⸮
wake up

I compiled and uploaded using board package version 3.1.2 (the last) and board 'nodeMCU 1.0 (ESP 12-E module)

I get a short flash at wake-up and then the 10 flashes that i should.

Re continuity between D0 & RST, not sure what I'm doing here but it shows open circuit on my DVM.

I'm running the arduino IDE(V1.8.19) in Linux (Kubuntu).