EDIT: Updating topic . Didn't find any Modes that allows wifi connection in sleep mode
Now i have a different problem i am trying to use deepsleep .For some reason when the device go to deepsleep and i press rst in order to wakeup the device dosent boot up .it only boot up when i press reset again . Need to press rst twice in order to get esp8266 normal working again . I checked the boot log and this was the output
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
load 0x4010f000, len 3424, room 16
tail 0
chksum 0x2e
load 0x3fff20b8, len 40, room 8
tail 0
chksum 0x2b
csum 0x2b
v00042800
~ld
rf cal sector: 1020
freq trace enable 0
on the first press on rst the boot get stuck in that msg
ets Jan 8 2013,rst cause:2, boot mode:(3,6)
When i press again the rest comes and code works as normal should.
Source code:
#include <ESP8266WiFi.h>
const char* ssid = "SSID";
const char* password = "PASS";
void setup() {
Serial.begin(115200);
Serial.println();
// uint32_t bootMode = ESP.getBootMode();
// Serial.print("Boot mode: ");
// Serial.println(bootMode);
// Connect to Wi-Fi
WiFi.begin(ssid, password);
Serial.println();
int attempts = 0;
while (WiFi.status() != WL_CONNECTED && attempts < 20) {
delay(500);
Serial.print(".");
attempts++;
}
if (WiFi.status() == WL_CONNECTED) {
Serial.println("Connected to Wi-Fi");
} else {
Serial.println("Failed to connect");
}
// Configure light sleep to wake up when the button is pressed
Serial.println("Entering sleep mode");
ESP.deepSleep(0); // `0` means stay in light sleep indefinitely
delay(10);
}
void loop() {
// Serial.println("Entered loop");
// delay(1000);
}
Currently the device is powered using usb and i only connected a switch to rst .And the issue only persist when i use deepsleep .So i hope it has to do with that part .Any one has any idea how to fix this issue ..