Page 1 of 1

WiFi reconnect fails, AP records "interference detected"

Posted: Fri Dec 15, 2023 8:34 am
by espixo
Hi,

My esp32doit-devkit-v1 (powered from stable 5V supply on VIN), programmed with platformio setup (espressif32@6.4.0, arduino) is supposed to run 24/7, monitor one GPIO and send me a mail upon changes. However - there is a problem with the WiFi connection and I'm out of ideas even whether it's caused by hardware or software issues.

Typically it works well for days, surviving several channel changes made by the WiFi router where it is connected to.

But once in a while, it cannot reconnect after such event anymore. The WiFi router (a Fritz!Box 7490) in this situation logs a "interference detected on channel X" (where X is the channel that *was* active before the change).

My debug output (on Serial) in this case ends like

Code: Select all

08:26:50 - WL_CONNECTED 192.168.2.112 ch=6 rssi=-49
08:26:50 - WL_CONNECTED 192.168.2.112 ch=6 rssi=-49
[WiFi-event] event: 5 Disconnected from WiFi access point (ARDUINO_EVENT_WIFI_STA_DISCONNECTED)
08:28:50 - WL_CONNECT_FAILED
[WiFi-event] event: 9 Lost IP address and IP address is reset to 0 (ARDUINO_EVENT_WIFI_STA_LOST_IP)
08:29:50 - WL_IDLE_STATUS 
08:29:50 - WL_IDLE_STATUS
...
I tried several variants of code with WiFi.setAutoReconnect(true) or combinations of disconnect/reconnect/begin(), which seem to work sometimes but not always; especially (so it seems) worse when the device is unmonitored (just powered, no serial connection). I also read about the problems with EN/BOOT signals on boards with CH340 USB-Serial but on mine (with CP2102) they seem to be stable around 3v3. Now I don't know where to look further.

Does this description ring any bell..? any ideas?

Thanks in advance!
Kolja

Re: WiFi reconnect fails, AP records "interference detected"

Posted: Fri Dec 15, 2023 4:25 pm
by lbernstone
Reconnect attempts to use the existing lease information. If the AP has invalidated that, it may not be able to re-establish the connection. Fritzbox devices seem to generate more issues with esp32 than any other mfr. A more reliable way to reconnect is to watch for an event like STA_LOST_IP and do a WiFi stop and begin.