-
Notifications
You must be signed in to change notification settings - Fork 52
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
Wifi Stability has gotten worse since move from Arduino to PlatformIO #115
Comments
Interesting. Arduino and PlatformIO should not have anything to do with this issue. WiFi is handled by the Espressif's core. Maybe you had an older core installed in Arduino; maybe the IDE didn't update the core; maybe the old IDE didn't even support newer core versions. My SOHO wifi setup doesn't even offer the WPS anymore as it was deemed a security risk (TP-Link Omada). So I can't test it. Another thing that comes to mind is the partition table. I remember that WiFi needs a special slot in the Flash memory where it stores the key. Maybe we forgot to include that section in the .csv file when migrating from Arduino to PlatformIO. |
You may be on to something there. I tried reprogramming the ESP32 with the old Arduino IDE firmware but it doesn't recognize the SPIFFS partition generated by PlatformIO. |
Really interesting ;) I already worked on the "never leaving connecting loop" part and implemented a timeout in one of my branches...The problem is, that also the real time clock fall back seems to not working, if the WiFi is not working at all...The clock ist showing only zeros then...Never found the time to go on with that fix. We have a NVS partition with a size of 0x7000 (28672) Bytes. And the whole settings are stored and read from there. I checked the NVS stuff a bit further and it seems, as if we need to initalize the NVS flash usage before using anyway... Especially before using the higher level Wifi functions. On the other hand, if there is a general problem that the clock is unable to read the config values from NVS after a while, we need to check this further anyway...I never noticed something like that on any of my clocks yet. The WPS structure (esp_wps_config_t) can be inialized with a macro.
It should never be emptied to zeros. But it is all the same init in the end. The idea to init "our" wifi structure completly with zeros on a WPS initial connect and in error case seems valid to me, but I am not sure, why this should fix, that the PSK seems to be deleted after some time...PSK is stored in RAM only, if NVS is not used and in the special values (namespace) for the wifi driver, if active. After which time period does the problem show up to you? Hours? Days? I will add some code snippets as well soon ;) Bye |
See below for terminal output from my OpenWRT (Gargoyle) router. The output is from I can force the clock to trigger the bug by calling the |
I'll attempt to get the debug logs from my clock soon. |
See attached |
My v1 Elekstube clock has been running for over a year at least without the 3.3V mod, so my ESP32 may be slightly toasted.. I did do the mod today just to see if the behavior of the clock would change, but it hasn't. I haven't had any problems reflashing the ESP32 or with the clock image files getting corrupted. |
I created another PR with your changes and my idea :) Maybe you can give it a try and tell us, if there is a behavoir change... And I have to watch the logs tomorrow...thx! |
I think this might be because the partition table we have in the .csv (and in the flash) is different than default selection(s) in the Arduino IDE. So it wants to overwrite whole flash with the different formatting.
In my old wifi setup (simple router with WPS) and Clock programmed in Arduino it was working over many months and many clock and wifi restarts.
This is weird. Did you check the battery of your RTC? On my v1 clock it works fine. |
When my v1 Elekstube has a dead RTC battery it always thinks it's 16:00 when it can't reach the internet after power cycle (it still ticks up as normal). All zeroes would indicate some problem with communication with the DS3231 since that's how the library returns when there's a problem.. Just for fun I tried updating my router to the latest stable OpenWRT. Before it was on a fork with a different web UI called Gargoyle. If I use the "Disconnect" button in the router web UI the clock will reconnect successfully, but it still is unable to reconnect if I run the |
Huh, so maybe router is the culprit that forgets the authentication key :) |
Well I am unable to reflash the old Arduino firmware because the SPIFFS plugin doesn't work on my machine (it doesn't generate the partition correctly and errors out). I'm still not convinced yet that it's a bug in OpenWRT, because the old Arduino firmware worked fine. I wish I had dumped the flash before writing the new firmware to it.. |
The last version with the Arduino dir present is from last february use
to get it... |
I watched the logs so far, and the first disconnect (Reason 2) could indicate that the signal strength is too weak to maintain the connection... Which authentication methods are selected on the router? WPA2 only, or WPA2 and WPA3? Can you also try adding a printout of the Wi-Fi signal strength? Maybe log it in the main loop every second, and also while reconnecting (not sure if this works after a disconnect has already happened).
And then tell us the results here. Maybe also with timestamps for both logs. Serial Monitor extension in VS Code from MS is my favorite for this. I will also try to reduce the signal strength of my router while using my clocks, maybe one of them will have the same issues. Another question: Is the red "NO WIFI" showing up if this happens or does it goes to the WPS push connection mode again? Bye |
I tried my best to simulate your case, but no luck so far. see my logs: COM7_2025_01_30.23.36.03.792.txt Modified brach so far under: relevant settings: |
Certain devices in my house didn't like having WPA3 enabled, so the router is WPA2 only. It seems to have been a bug in the previous OpenWRT Last night (on the new OpenWRT firmware..) I was able to trigger the bug but I'm assuming it's something really hard to fix/find with the PHY driver on my specific router and probably involves some sort of race condition. The clock did show up in the web UI after running the I will reopen the issue if I am able to get the bug to come back and I'm sure it's not actually a problem with my router. Thank you for your time and effort! |
well, I was able to get the bug to trigger again just now :( |
I tried the debug firmware from @Martinius79's branch and I haven't really gotten any more info than what I've already gathered. The signal does indeed cut out for a few seconds after running the |
The ESP32 has had similar problems in the past with some other well-known routers. Here in Germany, the "Fritz!Box" series from AVM is very popular, and they had issues with authentication and the handshake some years ago with older firmware versions. See: espressif/arduino-esp32#2501 So, I guess it is a combination of the Espressif/Arduino framework's WiFi implementation and the router firmware you are using. OpenWRT issues on the GitHub mirror: https://github.com/openwrt/openwrt/issues I didn't find anything useful in the recent issues related to the keyword "ESP32," but maybe you have more insight and can find additional information. |
Two more things:
|
Hardware: Elekstube v1
FW version: a337352
I'm using WPS so I don't have to reflash the entire firmware just to change Wi-Fi settings. I noticed the new firmware has Wi-Fi amnesia after a few hours. The ESP32 seems to "forget" the PSK (my OpenWRT router says failed WPA 4-way handshake, "possibly wrong PSK?"). After it forgets the key it gets stuck on "connecting.." on power cycle, but it doesn't time out. My router doesn't see any more connection attempts after power-cycling the ESP32..
I'm working on a PR to resolve this, but I don't have an ETA right now. I will open the PR as a draft after posting this.
The text was updated successfully, but these errors were encountered: