-
Notifications
You must be signed in to change notification settings - Fork 7.6k
WiFi Strange behavior about connection/reconnection #2769
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
Comments
If not fast resolution coming we must come back to 1.0.0 but we ve some problems with i2c, millis, core temperature and some big bug |
there is a fix coming for the wifi issues. |
Many Thanks |
I have merged updated IDF lib. It's only available through github. Could you try them and see if your issues are resolved? |
Yes now I'm loading on devices, test require 24/48h max . |
thanks :) |
can I use 1.0.3 rc from board manager ? git give me always strange issue |
yes :) I tagged it so you and other people with wifi issues can test |
not download , give error on board manager |
something went wrong the first time. I have updated the release. Please try again :) |
ok it go ! |
Now I test it, first connection not go (always), second go , now I test many situations |
example : Port open |
now we test all days , I report as soon as possible |
Note : We new library 1.0.3 i start to use our chip of memory , eeprom is not use anymore |
About some devices : 3 lost connection and 2 of this after 30/40 min re-connected. Our code not use autoconnect and disabile it, also we use olle manual begin with user and password, we disconnect every time we see lost connection and our code begin our code routine to connect again |
We se only auth exp but we see many logs inside esp-idf this library not report it, as you see on our report example , two connection fail (ssid wrong and is ok), but with recovery, first try not go , always |
About SSID we underline with router with wireless access point , seems esp not choose best signal but choose randomlly, also we see on ESP MDF where channel is fixed and esp not capace to change it about watchdog , one device it blocks on loop wifi, watchdog unable to reset it |
Yup we are on the latest IDF 3.2 with whatever bugfixes were added to it. |
WiFi seems has same problems, but now I test it in STATIC mode, it seems work without reconnection, I suppose two reason , Arduino library not manage correctly or not manage a WiFi.status(), or ISSUE of re-connection is a mask for a issue of DHCP , I give to you an example of our routine , but I think we restrict issue to this two ways, DHCP or WiFi.status() (after reconnections. ? ) |
wl_status_t wifi_connect(boolean recovery)
{
static unsigned long conn_timeout = 5000;
static unsigned long t0, t1 = 0;
char wssid[30], wpasswd[30];
if (WiFi.status() == WL_CONNECTED)
{
WiFi.disconnect();
}
WiFi.mode(WIFI_MODE_STA);
WiFi.setHostname("Electric Labs Device");
if (recovery)
{
snprintf(wssid, sizeof(wssid), "Test");
snprintf(wpasswd, sizeof(wpasswd), "prova");
}
else
{
if (memory.iptype == 100)
{
WiFi.config(convertfromStringSTD(memory.ipset), convertfromStringSTD(memory.ipgateway), convertfromStringSTD(memory.ipmask));
}
snprintf(wssid, sizeof(wssid), memory.ssid);
snprintf(wpasswd, sizeof(wpasswd), memory.password);
}
WiFi.begin(wssid, wpasswd);
t0 = t1 = millis();
while ((WiFi.status() != WL_CONNECTED) && ((t1 - t0) < conn_timeout))
{
delay(500); // internal memory // recovery memory
if (!recovery){ledcommands(false, false, 0, 2);} else { ledcommands(false, false, 0, 2);}
delay(500);
if (!recovery){ledcommands(true, false, 0, 2);} else { ledcommands(false, true, 0, 2); }
t1 = millis();
}
return WiFi.status();
} |
boolean wifi_start()
{
WiFi.setAutoReconnect(false);
int RETRY_MAX = 3;
int retry = 0;
boolean memory_connected = false;
wdtreset();
while (retry < RETRY_MAX)
{
debug("[wifi_start] Tentativo di connessione (EEPROM) "); debug((retry + 1)); debug(" di "); debugn(RETRY_MAX);
wl_status_t result = wifi_connect(false);
int rssi = 0;
int value2 = 0;
switch (result)
{
case WL_CONNECT_FAILED:
debugn("[wifi_start] Connessione fallita");
break;
case WL_CONNECTED:
currentIP.fromString(WiFi.localIP().toString());
server[0] = currentIP[0];
server[1] = currentIP[1];
server[2] = currentIP[2];
server[3] = 89;
serial[0] = currentIP[0];
serial[1] = currentIP[1];
serial[2] = currentIP[2];
broadcast[0] = currentIP[0];
broadcast[1] = currentIP[1];
broadcast[2] = currentIP[2];
broadcast[3] = 255;
WiFi.SSID().toCharArray(datassid, 30);
debugn("[wifi_start] Connesso!");
debugn(" --------------------------------------- ");
debug(" - Wifi SSID : ");
debugn(datassid);
debug(" - Wifi ip : ");
debugn(currentIP.toString());
debug(" - Size of structt : ");
debugn(sizeof(memory));
debug(" - Wifi Mac : ");
debugn(macAddress);
debug("- WIFI signal : ");
rssi = WiFi.RSSI();
debugn(rssi);
value2 = abs(rssi);
if (value2 <= 30) { debugn("- Signal level is < -30 Perfect "); }
if ((value2 > 30) && (value2 <= 67)) { debugn("- Signal level is < -67 Very Good "); }
if ((value2 > 67) && (value2 <= 70)) { debugn("- Signal level is < -70 Ok but is low >30mbit "); }
if ((value2 > 72) && (value2 <= 80)) { debugn("- Signal level is < -80 not so Good (about 15-5 mbit) "); }
if (value2 > 80) { Serial.println("- Signal level is > -80 - Warning is UNSTABLE "); }
debug(" - Firm.Chip :");
debugn(ESP.getSdkVersion());
debug(" - EHI SW : ");
debugn(systemversion);
debug(" - IP configuration : ");
if (memory.iptype == 100) { debugn("system uses Ip fixed"); }
else {
debugn("system on DHCP");
debug(" - IP on dhcp : ");
debugn(WiFi.localIP());
debug(" - IPGateway on dhcp : ");
debugn(WiFi.gatewayIP());
debug(" - IPmask on dhcp : ");
debugn(WiFi.subnetMask());
}
if (memory.iptype == 100) {
debug(" - IP fixed : ");
debugn(memory.ipset);
debug(" - IPmask fixed : ");
debugn(memory.ipmask);
debug(" - IPGateway fixed : ");
debugn(memory.ipgateway);
}
debug(" - Server : ");
debugn(server);
debug(" - Serial : ");
debugn(serial);
debug(" - Broadcast : ");
debugn(broadcast);
debugn(" --------------------------------------- ");
memory_connected = true;
connessioneScelta = 1;
retry = RETRY_MAX;
iamaliveSQLforecast();
break;
default:
debug("[wifi_start] Stato WiFi: "); printWiFiStatus(WiFi.status());
break;
}
retry++;
}
if (!memory_connected)
{
wdtreset();
retry = 0;
while (retry < RETRY_MAX)
{
debug("[wifi_start] Tentativo di connessione (Recovery) "); debug((retry + 1)); debug(" di "); debugn(RETRY_MAX);
wl_status_t result = wifi_connect(true);
int rssi = 0;
int value2 = 0;
switch (result)
{
case WL_CONNECT_FAILED:
debugn("[wifi_start] Connessione fallita");
break;
case WL_CONNECTED:
currentIP.fromString(WiFi.localIP().toString());
WiFi.SSID().toCharArray(datassid, 30);
server[0] = currentIP[0];
server[1] = currentIP[1];
server[2] = currentIP[2];
server[3] = 89;
serial[0] = currentIP[0];
serial[1] = currentIP[1];
serial[2] = currentIP[2];
broadcast[0] = currentIP[0];
broadcast[1] = currentIP[1];
broadcast[2] = currentIP[2];
broadcast[3] = 255;
WiFi.SSID().toCharArray(datassid, 30);
debugn("[wifi_start] Connesso!");
debug("\tModalità: Recovery");
debugn(" --------------------------------------- ");
debug(" - Wifi SSID : ");
debugn(datassid);
debug(" - Wifi ip : ");
debugn(currentIP.toString());
debug(" - Size of structt : ");
debugn(sizeof(memory));
debug(" - Wifi Mac : ");
debugn(macAddress);
debug("- WIFI signal : ");
rssi = WiFi.RSSI();
debugn(rssi);
value2 = abs(rssi);
if (value2 <= 30) { debugn("- Signal level is < -30 Perfect "); }
if ((value2 > 30) && (value2 <= 67)) { debugn("- Signal level is < -67 Very Good "); }
if ((value2 > 67) && (value2 <= 70)) { debugn("- Signal level is < -70 Ok but is low >30mbit "); }
if ((value2 > 72) && (value2 <= 80)) { debugn("- Signal level is < -80 not so Good (about 15-5 mbit) "); }
if (value2 > 80) { Serial.println("- Signal level is > -80 - Warning is UNSTABLE "); }
debug(" - Firm.Chip :");
debugn(ESP.getSdkVersion());
debug(" - EHI SW : ");
debugn(systemversion);
debug(" - IP configuration : ");
if (memory.iptype == 100) { debugn("system uses Ip fixed"); }
else {
debugn("system on DHCP");
debug(" - IP on dhcp : ");
debugn(WiFi.localIP());
debug(" - IPGateway on dhcp : ");
debugn(WiFi.gatewayIP());
debug(" - IPmask on dhcp : ");
debugn(WiFi.subnetMask());
}
if (memory.iptype == 100) {
debug(" - IP fixed : ");
debugn(memory.ipset);
debug(" - IPmask fixed : ");
debugn(memory.ipmask);
debug(" - IPGateway fixed : ");
debugn(memory.ipgateway);
}
debug(" - Server : ");
debugn(server);
debug(" - Serial : ");
debugn(serial);
debug(" - Broadcast : ");
debugn(broadcast);
debugn(" --------------------------------------- ");
connessioneScelta = 2;
retry = RETRY_MAX;
iamaliveSQLforecast();
break;
default:
debug("[wifi_start] Stato WiFi: "); printWiFiStatus(WiFi.status());
break;
}
retry++;
}
}
return WiFi.status() == WL_CONNECTED;
} |
void printWiFiStatus(wl_status_t state)
{
switch (state)
{
case WL_NO_SHIELD:
debugn("WL_NO_SHIELD");
break;
case WL_CONNECTED:
debugn("WL_CONNECTED");
break;
case WL_IDLE_STATUS:
debugn("WL_IDLE_STATUS");
break;
case WL_NO_SSID_AVAIL:
debugn("WL_NO_SSID_AVAIL");
break;
case WL_SCAN_COMPLETED:
debugn("WL_SCAN_COMPLETED");
break;
case WL_CONNECT_FAILED:
debugn("WL_CONNECT_FAILED");
break;
case WL_CONNECTION_LOST:
debugn("WL_CONNECTION_LOST");
break;
case WL_DISCONNECTED:
debugn("WL_DISCONNECTED");
break;
}
} |
please read how to paste code :) |
sorry I do with cell phone, it's a bit confusing, thanks for reformat |
UPDATE : With static configuration and this library, no issue, therefore I think it would be something with disconnection and DHCP is wrong. We can not investigate inside, we not have other information about AUTH_EXP from verbose logs, do you know something about DHCP issues ? |
Other test and continuos operative test on STATIC IP not has issue, I think we can close circle on DHCP |
Continues test and no issue, uses watchdog with while(1) blocking function it works. |
Now it working so better without freeze, but I see sometimes reconnection and sometimes reboot of ESP32 WROOM D. I hope soon @me-no-dev you will upgrade to new IDF with new bug fix about wifi, I see on logs many correction , we need stable working library. Hope to improve signal performance, it's lower than first firmware. |
I am experiencing something similar: #2999 Any luck with this ? |
now I see new IDF loaded .. I'm waiting new RC to test it .. at now go better but signal so so .. sometimes not freeze but reboot .. i wait to test it |
I'm wondering if this has to do with this issue: #2899 However, in the last IDF update CONFIG_ESP32_WIFI_RX_BA_WIN was changed to 16 from 6 |
I'm curious if the problems people are having with reconnecting to wifi have anything to do with the power being provided? This seems to only happen to me when running a smaller power supply. When it tries to reconnect to the AP, it fails and eventually freezes. It seems to not disconnect in the first place with more power, but if it does, it reconnects easier. Edit: I tried this with the latest IDF and settings, but still got a freeze, and had to reboot. It's very hard to log this behavior since it only happens without a serial connection. |
You could just copy the current files in the repository. I did this, but unfortunately it didnt solve my issue. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
Hardware:
Board: ESP32 WROOM 32D
Core Installation version: 1.0.2 stable
IDE name: Arduino IDE/ Visual Micro on Visual Studio
Flash Frequency: 80cpu/80flash
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
In this month we 've fond many issue that weren't on 1.0.0, but we need temperature reduction with low core, therefore we must use 1.0.2.
WiFi fail sometimes to reconnect, also watchdog sometimes fail to reboot board , we not find any issue about our code.
We ve see many issue but no response from espressif coders, we ve also use ESP-IDF base sdk but issue is hide on WiFi core working and we not investigate inside.
We hope a fast resolving bugfix because devices are not stable and not usable.
Debug Messages:
Always verbose logs about fail reconnection says "AUTH_EXP" looping
about watchdog , says not triggered many times continuosly, core 0 seems live but core 1 freezed and try rebooting but nothing do, board freeze.
The text was updated successfully, but these errors were encountered: