-
Notifications
You must be signed in to change notification settings - Fork 13.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WD reboot] Reconnect to WiFi AP cause WD reboot #6266
Labels
waiting for feedback
Waiting on additional info. If it's not received, the issue may be closed.
Comments
5 tasks
Just as a reference to myself (and anyone interested ;) ) In short, the code handling this in ESPeasy: void setWifiMode(WiFiMode_t wifimode) {
const WiFiMode_t cur_mode = WiFi.getMode();
if (cur_mode == wifimode) {
return;
}
if (wifimode != WIFI_OFF) {
#ifdef ESP8266
// See: https://github.com/esp8266/Arduino/issues/6172#issuecomment-500457407
WiFi.forceSleepWake(); // Make sure WiFi is really active.
#endif // ifdef ESP8266
delay(100);
}
switch (wifimode) {
case WIFI_OFF:
addLog(LOG_LEVEL_INFO, F("WIFI : Switch off WiFi"));
break;
case WIFI_STA:
addLog(LOG_LEVEL_INFO, F("WIFI : Set WiFi to STA"));
break;
case WIFI_AP:
addLog(LOG_LEVEL_INFO, F("WIFI : Set WiFi to AP"));
break;
case WIFI_AP_STA:
addLog(LOG_LEVEL_INFO, F("WIFI : Set WiFi to AP+STA"));
break;
default:
addLog(LOG_LEVEL_INFO, F("WIFI : Unknown mode"));
break;
}
if (!WiFi.mode(wifimode)) {
addLog(LOG_LEVEL_INFO, F("WIFI : Cannot set mode!!!!!"));
}
if (wifimode == WIFI_OFF) {
delay (1000);
WiFi.forceSleepBegin();
delay (1);
} else {
setupStaticIPconfig();
delay(30); // Must allow for some time to init.
}
} |
TD-er
added a commit
to TD-er/ESPEasy
that referenced
this issue
Jul 28, 2019
Main change is this one: esp8266/Arduino#6266 (comment) Let's hope all WiFi related WDT reboots are now over.
@TD-er a lot has changed since this was reported, including fixes that are relevant. Please retest with 2.6.0. |
devyte
added
the
waiting for feedback
Waiting on additional info. If it's not received, the issue may be closed.
label
Nov 9, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
waiting for feedback
Waiting on additional info. If it's not received, the issue may be closed.
Basic Infos
Platform
Settings in IDE
Problem Description
This has been discussed also in other issues like here, but since it does appear to be something different and also to keep the information in a single issue I thought it would be better to make a separate issue for it.
The problem is, for over a year now, I get lots of reports of WD reboots which are really hard to reproduce.
I now have found a way to reproduce it on my nodes using the disconnect feature of my (MikroTik) AP and narrowed it down to somewhere in the code used to (re)connect to WiFi.
There may still be several issues at stake here, and for sure it will not be the only reason for WD reboots, but I believe it is responsible for lots of them.
What I found is that the WD-reboots do happen right at the moment the WiFi connection transitions from "connected" to "Got IP".
The same transition does happen when static IP is being used.
This can happen at the first connect attempt or at any other reconnect, but it doesn't happen always.
The standard WiFi connection cycle can be seen as several stages:
Every now and then the last step does halt the system for some reason. Not even the loop() function is called then and thus a WD-reboot.
I do not see the last event happening in all these situations where the WD reboot occur.
To trigger it, I force a WiFi disconnect from my AP (a MikroTik) for the node I'm testing.
Sometimes the disconnect is not even seen at the ESP. There is no disconnected event fired and the connection just continues like nothing has happened.
It also may just do a disconnect after which the ESP does perform a new reconnect and continues work.
But every now and then the reconnect process does lead to a WD reboot.
A WiFi disconnect is just something that's very normal.
For example if the WiFi AP does change channels, or if there have been too many errors reported (can also be in the transmission of another client).
A lot of circumstances reported by users also can be explained with a WiFi reconnect happening:
What I've already tried:
WiFi.status()
and not doing anything other than logging output and callingdelay(100)
Another thing, which may or may not be related.
I noticed that explicily setting the IP config to all zeroes (IP, gateway, DNS....) will give these WD reboots almost always.
Even at the first connect attempt which should be successful. Only once in N times it was successful with N sometimes hitting 100 times.
When not setting the IP config but just calling the usual functions the first attempt was almost always successful (9/10 at least).
MCVE Sketch
I will try to make a simple sketch for this
Debug Messages
The text was updated successfully, but these errors were encountered: