esp8266 / esp8266/Arduino

Wemos D1 mini ESP8266 wifi got stuck at debug message 'pm open,type:0 0'

Open
#8,681 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
16.7k
Forks
13.1k
PR merge metrics
No merged PRs in 30d

Description

Hi there,

i have a Wemos D1 mini with ESP8266 on it and can connect to my wifi with the following code:

```
#include
#include
#include
#include

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");

const char* SSID = "MYSSID";
const char* PSK = "MYPSK";

WiFiClientSecure espClient; /* Secure client connection class, as opposed to WiFiClient */
PublicKey key(pubkey);

void setup_wifi() {
WiFi.setSleepMode(WIFI_NONE_SLEEP);
WiFi.mode(WIFI_STA);
WiFi.disconnect();
WiFi.begin(SSID, PSK);
Serial.println("Try to connect to wifi ");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println(WiFi.localIP());
espClient.setX509Time(timeClient.getEpochTime());
Serial.write(timeClient.getEpochTime());
}

void setup() {

// Serial Monitor
Serial.begin(115200);

// STATUS LED
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output

// WIFI
setup_wifi();
}


void loop()
{

}
```

So i also set the "not go to sleep" command for wifi.
The problem is, that wifi connects only when i restart my wifi in router. If i don't restart it, then sometimes the wifi will connect properly, but only for a few times. Then the wifi connecting will get stuck with the following wifi debug message:

```
connected with , channel 11
dhcp client start...
wifi evt: 0
pm open,type:0 0
```

So it seems to be connected, but there is no ip address allocated and the wifi status never reaches the WL_CONNECTED state.
The connection got stuck at **pm open,type:0 0**

I thought this is a problem with 5GHz wifi, so i turned it off in my router, which is now only set up to 2,4 GHz.
And i also changed the wifi channel selection from below channel 11 in my router settings.

I am very looking forward for any hints.

Thanks in advance!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.