-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Wifi disconnects after some time, reconnection fails #3362
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
I am having a similar problem. I am testing by changing the SSID on my router and it fails to reconnect after leaving for a good while (over 10 hours maybe.) The app is sending data from a queue to an MQTT server. It is running on a Lolin D32 and is repeatable on more than one device. The app is built in Arduino IDE. I am not doing any sort of wifi reconnect as I am expecting it to reconnect automatically. Maybe this is where I am going wrong. I have had the problem on version V1.0.4 and before this version V1.0.2 (I upgraded to see if it went away). 11:52:20.244 -> Attempting to reconnect in reconnect code..- Items in Queue Pressing the reset button works and the device starts correctly. I have now written a really simple sketch that just connects to wifi and then tries to connect to a url. 09:58:50.970 -> [V][ssl_client.cpp:56] start_ssl_client(): Free internal heap before TLS 264656 21/10/19 17:36 I then brought the SSID back and it connected ok. 16:39:54.814 -> [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 4 - STA_CONNECTED I then dropped the SSID and got this 16:40:34.166 -> [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 5 - STA_DISCONNECTED Nothing at all since then, so it appears to be hung. |
Well known issue on Arduino. The only solution as of today is to move to esp-idf |
I forgot about this thread. The issue kind of self solved somehow and the Wemos D1 R32 with its ESP32 now works fine and reconnections work after a reset or blackout. Edit: the problem is back xD This is what happens when a problem self solves and you don't know what caused it. Again my router shows the ESP32 MAC address but it's marked as not associated and not authorized. I still don't know what the problem was. The distance to the router is the same, I also erased the flash before updating sketches as usual, but it self solved. |
So I changed the sketch and now I call this function to connect on boot and reconnect on connection lost: void recon() Fun thing about it, the ESP32 is now completely unable to connect. It attempts reconnections when status returns not connected, but it won't connect. There are moments where that function finishes because it has managed to reconnect, only that it hasn't. On my router page I can see that it's not connected. Some of you may say the problem is the router, but as I said in the first post, there is another ESP32 connected to that router and it has been working great for more than a year. These last weeks I have been reading a lot about this issue. I don't know what is failing on this ESP32 that it's not on the other. Is it the rotary enconder library? The pin14 I'm using? (I read somewhere that pin14 cannot be used for ADC if wifi's on, but I'm using it as digital output. I also doubt that's the issue because this ESP32 could stay working for several days and after each power cycle it got worse. |
Hi maxdd, can you explain a bit more, I have searched and can't find much about it being a well known issue. |
Hello Inrobby, you just can have a look at the open issue by tiping "reconnection" The underline problem here is that somehow the WiFi library is not there yet for esp32.
In my case, ever since i used this, i never dropped once (but never say never). |
Maxdd Thanks for this. I will try this. Shame no-one is picking up the actual problem to fix it. |
Hi again, I have activated the debug level verbose and I see nothing but lots of AUTH_EXPIRE and STA_DISCONNECTED callbacks, I don't know if this helps to identify the problem. |
Does this issue be related to the ADC2 channel? Because Wifi drivers use ADC2 pins |
But does that mean you can't use those even as digital outputs? |
I saw that at this thread #1829 |
[STALE_SET] 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. |
I faced similar problem,
} That means it needs wifi.disconnect (bool , bool).
so when the wifi.status() == 0 (or wifi.status() == 5, just to check right now if truly the device disconnects or not) when i shut down router, the status goes to == 5 ) I am still not sure if it will work like this even after 2 hours or not, but I am hoping that with all this clear status modes there has to be no reason for device to connect properly. |
hi sir how are you can you help me for this |
Happening to me too. |
edit: never mind, it was a fluke. Issues just come and go.. more often than not I can't get a connection. |
Hardware:
Board: Wemos D1 R32
Core Installation version: Don't know
IDE name: Arduino IDE
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 921600
Computer OS: Windows 10
Description:
I have a Wemos D1 R32 to open the garage door. It has been working perfectly 24/7 for over a year and it's still working fine.
I bought another Wemos D1 R32 for a project with some relays to turn lights on and off, and this one is giving me problems.
It's connected to the same router as the other board, using a static IP. On boot, it connects and works fine, I can tell this by doing a 1000 packets Ping, no packets lost. But after some hours, packets start to get lost, more and more, until the code detects the wifi connection is lost and tries to reconnect, but fails.
The interesting thing is that the connection and reconnection code is the same I'm using in the first board that works perfect, but somehow it's failing on the second board.
I also noticed that my router says that the board is connected but not associated nor authorized. The wifi key is a 20 character alfanumeric WPA2 password. The board that works is shown as asociated and authorized.
imgur.com/a/02H8xl6
Sketch:
(This is not the full sketch since it's very long, with UDP, rotary encoder and OLED codes, I will post what I think is giving the problems)
The text was updated successfully, but these errors were encountered: