[GH-ISSUE #1067] CONNECTION PROBLEMS, restart, or every other restart #909

Open
opened 2026-02-28 01:27:37 +03:00 by kerem · 27 comments
Owner

Originally created by @tablatronix on GitHub (May 25, 2020).
Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1067

There has been several issues with problems with wifi not connecting. But after restarts it works.
Or every other restart it fails

Sometimes there are errors like wrong password, or ap not found

This issue is for investigating this to find some common issue.

I suspect it is a race condition or router issue with certain SDKs etc. It could also be a simple bug like autoconnect is connecting while esp is auto-connecting and it hangs. Or set sta is not returning fast enough and is asynchronous, there has been proof of this and issues by me created in esp libs.

Originally created by @tablatronix on GitHub (May 25, 2020). Original GitHub issue: https://github.com/tzapu/WiFiManager/issues/1067 There has been several issues with problems with wifi not connecting. But after restarts it works. Or every other restart it fails Sometimes there are errors like wrong password, or ap not found This issue is for investigating this to find some common issue. I suspect it is a race condition or router issue with certain SDKs etc. It could also be a simple bug like autoconnect is connecting while esp is auto-connecting and it hangs. Or set sta is not returning fast enough and is asynchronous, there has been proof of this and issues by me created in esp libs.
Author
Owner

@tablatronix commented on GitHub (May 25, 2020):

I will look into wm as the cause of this issue, since it is occurring on both platforms

<!-- gh-comment-id:633706947 --> @tablatronix commented on GitHub (May 25, 2020): I will look into wm as the cause of this issue, since it is occurring on both platforms
Author
Owner

@TheNitek commented on GitHub (May 25, 2020):

I already linked it in #979 but just to have it here again. I don't think it's bug in WifiManager but in the SDK: https://github.com/espressif/arduino-esp32/issues/2501 (nevertheless one that the WifiManager can work around)

<!-- gh-comment-id:633707678 --> @TheNitek commented on GitHub (May 25, 2020): I already linked it in #979 but just to have it here again. I don't think it's bug in WifiManager but in the SDK: https://github.com/espressif/arduino-esp32/issues/2501 (nevertheless one that the WifiManager can work around)
Author
Owner

@TheNitek commented on GitHub (May 25, 2020):

BTW I also suspect the router model to be important for this: In my case it's a Fritz!Box 6490.

<!-- gh-comment-id:633708290 --> @TheNitek commented on GitHub (May 25, 2020): BTW I also suspect the router model to be important for this: In my case it's a Fritz!Box 6490.
Author
Owner

@alfo commented on GitHub (May 25, 2020):

I’ve been having issues with both the ESP8266 and the ESP32 using v2.x.x of WiFiManager but notably the problem goes away on v0.1.5 on my ESP8266, so it might be worth having a look at what changed inside the autoConnect function?

I agree it’s probably true that WiFi routers also play a part in this, in my case I’m using a Ubiquity nanoHD access point (with two APs, one downstairs, broadcasting on the same SSID). Maybe that has something to do with it?

<!-- gh-comment-id:633708930 --> @alfo commented on GitHub (May 25, 2020): I’ve been having issues with both the ESP8266 and the ESP32 using v2.x.x of WiFiManager but notably the problem goes away on v0.1.5 on my ESP8266, so it might be worth having a look at what changed inside the autoConnect function? I agree it’s probably true that WiFi routers also play a part in this, in my case I’m using a Ubiquity nanoHD access point (with two APs, one downstairs, broadcasting on the same SSID). Maybe that has something to do with it?
Author
Owner

@1technophile commented on GitHub (May 26, 2020):

I confirm also that OpenMQTTGateway users were complaining about this issue with Ubiquity routers.

<!-- gh-comment-id:633757077 --> @1technophile commented on GitHub (May 26, 2020): I confirm also that [OpenMQTTGateway ](https://docs.openmqttgateay.com) users were complaining about this issue with Ubiquity routers.
Author
Owner

@tablatronix commented on GitHub (May 26, 2020):

One difference is we used to always disconnect,

//trying to fix connection in progress hanging
    ETS_UART_INTR_DISABLE();
    wifi_station_disconnect();
    ETS_UART_INTR_ENABLE();

But that adds 2 second startup time

This was removed in dev and made optional

    // clean connect, always disconnect before connecting
    void          setCleanConnect(bool enable); // default false

I have also encountered issues where waitforconresult timesout and never connects ( which takes forever )

<!-- gh-comment-id:633795024 --> @tablatronix commented on GitHub (May 26, 2020): One difference is we used to always disconnect, ```C++ //trying to fix connection in progress hanging ETS_UART_INTR_DISABLE(); wifi_station_disconnect(); ETS_UART_INTR_ENABLE(); ``` But that adds 2 second startup time This was removed in dev and made optional ```C++ // clean connect, always disconnect before connecting void setCleanConnect(bool enable); // default false ``` I have also encountered issues where waitforconresult timesout and never connects ( which takes forever )
Author
Owner

@tablatronix commented on GitHub (May 26, 2020):

A couple things to try that might be causing a race condition.

Try adding this delay and log to this function

bool WiFiManager::wifiConnectDefault(){
  bool ret = false;
  DEBUG_WM(F("Connecting to SAVED AP:"),WiFi_SSID(true));
  DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi_psk(true));
  ret = WiFi_enableSTA(true,storeSTAmode);

 // add these 2 lines
  delay(500); // <-- DELAY
  DEBUG_WM(DEBUG_DEV,"Mode after delay: "+getModeString(WiFi.getMode())); // <-- LOG

  if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed");
  ret = WiFi.begin();
  if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi begin failed");
  return ret;
}

Another thing to try

Remove the sta, begin will do this by itself also

bool WiFiManager::wifiConnectDefault(){
  bool ret = false;
  DEBUG_WM(F("Connecting to SAVED AP:"),WiFi_SSID(true));
  DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi_psk(true));
  // ret = WiFi_enableSTA(true,storeSTAmode); // <-- REMOVE
  // if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed");
  ret = WiFi.begin();
  if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi begin failed");
  return ret;

Also time how long waitforconnectresult takes, I have been meaning to add some debugging there for timing it. Does it take long when it fails?

<!-- gh-comment-id:633799844 --> @tablatronix commented on GitHub (May 26, 2020): A couple things to try that might be causing a race condition. Try adding this delay and log to this function ```C++ bool WiFiManager::wifiConnectDefault(){ bool ret = false; DEBUG_WM(F("Connecting to SAVED AP:"),WiFi_SSID(true)); DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi_psk(true)); ret = WiFi_enableSTA(true,storeSTAmode); // add these 2 lines delay(500); // <-- DELAY DEBUG_WM(DEBUG_DEV,"Mode after delay: "+getModeString(WiFi.getMode())); // <-- LOG if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed"); ret = WiFi.begin(); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi begin failed"); return ret; } ``` Another thing to try Remove the sta, begin will do this by itself also ```C++ bool WiFiManager::wifiConnectDefault(){ bool ret = false; DEBUG_WM(F("Connecting to SAVED AP:"),WiFi_SSID(true)); DEBUG_WM(DEBUG_DEV,F("Using Password:"),WiFi_psk(true)); // ret = WiFi_enableSTA(true,storeSTAmode); // <-- REMOVE // if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi enableSta failed"); ret = WiFi.begin(); if(!ret) DEBUG_WM(DEBUG_ERROR,"[ERROR] wifi begin failed"); return ret; ``` Also time how long waitforconnectresult takes, I have been meaning to add some debugging there for timing it. Does it take long when it fails?
Author
Owner

@thewavelength commented on GitHub (Aug 18, 2020):

I have the same issue. Sometimes, totally not reproducible for me (I'm sorry), I even get a crash which seems to be related to this. This happens now as long as I erase the flash and flash the image again.

*WM: [3] setupConfigPortal 
*WM: [1] Starting Web Portal 
*WM: [3] dns server started with ip:  10.0.1.1
*WM: [2] HTTP server started 
*WM: [2] WiFi Scan completed in 2308 ms
*WM: [2] Config Portal Running, blocking, waiting for clients... 
Guru Meditation Error: Core  0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC      : 0x00000000  PS      : 0x00060e30  A0      : 0x80157969  A1      : 0x3ffb4f00  
A2      : 0x3ffda6a0  A3      : 0x3ffdae1c  A4      : 0x3ffda134  A5      : 0x3ffda8d4  
A6      : 0x260d000a  A7      : 0x300d000a  A8      : 0x8015780c  A9      : 0x3ffb4ec0  
A10     : 0x3ffda6b0  A11     : 0x3ffdae1c  A12     : 0x3ffb4f0c  A13     : 0x00000044  
A14     : 0x00000001  A15     : 0x00000006  SAR     : 0x00000010  EXCCAUSE: 0x00000014  
EXCVADDR: 0x00000000  LBEG    : 0x4000c349  LEND    : 0x4000c36b  LCOUNT  : 0x00000000  

Backtrace: 0x00000000:0x3ffb4f00 0x40157966:0x3ffb4f40 0x40164e71:0x3ffb4f60 0x40169e79:0x3ffb4fa0 0x4016f116:0x3ffb4fc0 0x4015836f:0x3ffb4fe0 0x40088b9d:0x3ffb5010
<!-- gh-comment-id:675604454 --> @thewavelength commented on GitHub (Aug 18, 2020): I have the same issue. Sometimes, totally not reproducible for me (I'm sorry), I even get a crash which seems to be related to this. This happens now as long as I erase the flash and flash the image again. ``` *WM: [3] setupConfigPortal *WM: [1] Starting Web Portal *WM: [3] dns server started with ip: 10.0.1.1 *WM: [2] HTTP server started *WM: [2] WiFi Scan completed in 2308 ms *WM: [2] Config Portal Running, blocking, waiting for clients... Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled. Core 0 register dump: PC : 0x00000000 PS : 0x00060e30 A0 : 0x80157969 A1 : 0x3ffb4f00 A2 : 0x3ffda6a0 A3 : 0x3ffdae1c A4 : 0x3ffda134 A5 : 0x3ffda8d4 A6 : 0x260d000a A7 : 0x300d000a A8 : 0x8015780c A9 : 0x3ffb4ec0 A10 : 0x3ffda6b0 A11 : 0x3ffdae1c A12 : 0x3ffb4f0c A13 : 0x00000044 A14 : 0x00000001 A15 : 0x00000006 SAR : 0x00000010 EXCCAUSE: 0x00000014 EXCVADDR: 0x00000000 LBEG : 0x4000c349 LEND : 0x4000c36b LCOUNT : 0x00000000 Backtrace: 0x00000000:0x3ffb4f00 0x40157966:0x3ffb4f40 0x40164e71:0x3ffb4f60 0x40169e79:0x3ffb4fa0 0x4016f116:0x3ffb4fc0 0x4015836f:0x3ffb4fe0 0x40088b9d:0x3ffb5010 ```
Author
Owner

@tablatronix commented on GitHub (Jan 11, 2022):

I have been looking into this issue here
https://github.com/espressif/arduino-esp32/issues/2501

And made a PR here for workaround via autoreconnect bugfix
https://github.com/espressif/arduino-esp32/pull/6113

I also have an open issue with IDF against the actual cause under review

<!-- gh-comment-id:1009530030 --> @tablatronix commented on GitHub (Jan 11, 2022): I have been looking into this issue here https://github.com/espressif/arduino-esp32/issues/2501 And made a PR here for workaround via autoreconnect bugfix https://github.com/espressif/arduino-esp32/pull/6113 I also have an open issue with IDF against the actual cause under review
Author
Owner

@tablatronix commented on GitHub (Jan 24, 2022):

MY PR was merged, but if you need a solution without a patch

I added a test solution to wm, hardcoded, no setter. I can add a define or setter if its useful

    bool          _aggresiveReconn        = false; // use an agrressive reconnect strategy, WILL delay conxs
                                                   // on some conn failure modes will add delays and many retries to work around esp and ap bugs, ie, anti de-auth protections

This adds esp32 event handler for auth fail, and bumps reconnects up and adds delays, I have connect everytime, and my conx time goes to 5s unfortunately until this issue is also fixed in IDF that is what we have..

I have not worked on this issue or tested if it exists in esp8266, I will check that next

<!-- gh-comment-id:1019665980 --> @tablatronix commented on GitHub (Jan 24, 2022): MY PR was merged, but if you need a solution without a patch I added a test solution to wm, hardcoded, no setter. I can add a define or setter if its useful ```CPP bool _aggresiveReconn = false; // use an agrressive reconnect strategy, WILL delay conxs // on some conn failure modes will add delays and many retries to work around esp and ap bugs, ie, anti de-auth protections ``` This adds esp32 event handler for auth fail, and bumps reconnects up and adds delays, I have connect everytime, and my conx time goes to 5s unfortunately until this issue is also fixed in IDF that is what we have.. I have not worked on this issue or tested if it exists in esp8266, I will check that next
Author
Owner

@tablatronix commented on GitHub (Jun 17, 2022):

Theres seems to be 2 conditions here with different failures, this one for reauth timeout/retry there is also a 4 way handshake timeout or assoc failure which is possibly a different issue

<!-- gh-comment-id:1159036120 --> @tablatronix commented on GitHub (Jun 17, 2022): Theres seems to be 2 conditions here with different failures, this one for reauth timeout/retry there is also a 4 way handshake timeout or assoc failure which is possibly a different issue
Author
Owner

@dddhhhrrr commented on GitHub (Jun 20, 2022):

is there a workaround for this one? I tried the _aggressiveReconn = true fix and it connects but gives me an IP = 0.0.0.0

<!-- gh-comment-id:1160832231 --> @dddhhhrrr commented on GitHub (Jun 20, 2022): is there a workaround for this one? I tried the _aggressiveReconn = true fix and it connects but gives me an IP = 0.0.0.0
Author
Owner

@tablatronix commented on GitHub (Jun 21, 2022):

Hmm it shouldnt do you have logs?

<!-- gh-comment-id:1161053527 --> @tablatronix commented on GitHub (Jun 21, 2022): Hmm it shouldnt do you have logs?
Author
Owner

@dddhhhrrr commented on GitHub (Jun 21, 2022):

here's the output from the serial port:

mounting FS...
mounted file system
reading config file
opened config file
{"mqtt_server":"Dffssff","mqtt_port":"8083","api_token":"YOUR_API_T"}
parsed json
*wm:[2] Added Parameter: server
*wm:[2] Added Parameter: port
*wm:[2] Added Parameter: apikey
*wm:[1] AutoConnect
*wm:[2] ESP32 event handler enabled
*wm:[2] Connecting as wifi client...
*wm:[2] setSTAConfig static ip not set, skipping
*wm:[1] Connecting to SAVED AP: embeddex_2.4GHz
*wm:[1] connectTimeout not set, ESP waitForConnectResult...
E (5966) wifi:Association refused temporarily, comeback time 1048 mSec
*wm:[2] [EVENT] WIFI_REASON: 203
*wm:[2] [EVENT] WIFI_REASON: AUTH FAIL
*wm:[2] Connection result: WL_CONNECT_FAILED
*wm:[1] Connect Wifi, ATTEMPT # 2 of 5
*wm:[1] Connecting to SAVED AP: embeddex_2.4GHz
E (9614) wifi:sta is connecting, return error
*wm:[1] connectTimeout not set, ESP waitForConnectResult...
*wm:[2] Connection result: WL_CONNECT_FAILED
*wm:[1] Connect Wifi, ATTEMPT # 3 of 5
*wm:[1] Connecting to SAVED AP: embeddex_2.4GHz
*wm:[1] connectTimeout not set, ESP waitForConnectResult...
*wm:[2] Connection result: WL_CONNECTED
*wm:[1] AutoConnect: SUCCESS
*wm:[2] Connected in 7782 ms
*wm:[1] STA IP Address:
connected...yeey :)
The values in the file are:
mqtt_server : Dffssff
mqtt_port : 8083
api_token : YOUR_API_T
local ip
0.0.0.0

<!-- gh-comment-id:1161937140 --> @dddhhhrrr commented on GitHub (Jun 21, 2022): here's the output from the serial port: mounting FS... mounted file system reading config file opened config file {"mqtt_server":"Dffssff","mqtt_port":"8083","api_token":"YOUR_API_T"} parsed json *wm:[2] Added Parameter: server *wm:[2] Added Parameter: port *wm:[2] Added Parameter: apikey *wm:[1] AutoConnect *wm:[2] ESP32 event handler enabled *wm:[2] Connecting as wifi client... *wm:[2] setSTAConfig static ip not set, skipping *wm:[1] Connecting to SAVED AP: embeddex_2.4GHz *wm:[1] connectTimeout not set, ESP waitForConnectResult... E (5966) wifi:Association refused temporarily, comeback time 1048 mSec *wm:[2] [EVENT] WIFI_REASON: 203 *wm:[2] [EVENT] WIFI_REASON: AUTH FAIL *wm:[2] Connection result: WL_CONNECT_FAILED *wm:[1] Connect Wifi, ATTEMPT # 2 of 5 *wm:[1] Connecting to SAVED AP: embeddex_2.4GHz E (9614) wifi:sta is connecting, return error *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] Connection result: WL_CONNECT_FAILED *wm:[1] Connect Wifi, ATTEMPT # 3 of 5 *wm:[1] Connecting to SAVED AP: embeddex_2.4GHz *wm:[1] connectTimeout not set, ESP waitForConnectResult... *wm:[2] Connection result: WL_CONNECTED *wm:[1] AutoConnect: SUCCESS *wm:[2] Connected in 7782 ms *wm:[1] STA IP Address: connected...yeey :) The values in the file are: mqtt_server : Dffssff mqtt_port : 8083 api_token : YOUR_API_T local ip 0.0.0.0
Author
Owner

@tablatronix commented on GitHub (Jun 21, 2022):

hmm, that is odd, I may have seen this reported elsewhere, or as a different bug...
can you turn on esp debug level 5 or is that all its logging ?

<!-- gh-comment-id:1162295890 --> @tablatronix commented on GitHub (Jun 21, 2022): hmm, that is odd, I may have seen this reported elsewhere, or as a different bug... can you turn on esp debug level 5 or is that all its logging ?
Author
Owner

@tablatronix commented on GitHub (Jun 21, 2022):

What eps lib version , might want to try updating it , i think I recall a bug like this, ill try to test later

<!-- gh-comment-id:1162371507 --> @tablatronix commented on GitHub (Jun 21, 2022): What eps lib version , might want to try updating it , i think I recall a bug like this, ill try to test later
Author
Owner

@dddhhhrrr commented on GitHub (Jun 22, 2022):

I updated the ESP core version, it seems that it fixed it...

<!-- gh-comment-id:1163502086 --> @dddhhhrrr commented on GitHub (Jun 22, 2022): I updated the ESP core version, it seems that it fixed it...
Author
Owner

@tablatronix commented on GitHub (Jun 22, 2022):

Yeah I couldn't find the issue, but i specifically recall seeing a IDF bug with failing to set ip

<!-- gh-comment-id:1163593733 --> @tablatronix commented on GitHub (Jun 22, 2022): Yeah I couldn't find the issue, but i specifically recall seeing a IDF bug with failing to set ip
Author
Owner

@Robotto commented on GitHub (Oct 14, 2022):

I updated the ESP core version, it seems that it fixed it...

I'm still experiencing this issue with ESP core version 3.0.2 (via arduino board manager) on an ESP-12E
wm version 2.0.13-beta (via arduino library manager)

Is there a different combination of core and library versions where this works?

<!-- gh-comment-id:1278667600 --> @Robotto commented on GitHub (Oct 14, 2022): > I updated the ESP core version, it seems that it fixed it... I'm still experiencing this issue with ESP core version 3.0.2 (via arduino board manager) on an ESP-12E wm version 2.0.13-beta (via arduino library manager) Is there a different combination of core and library versions where this works?
Author
Owner

@tablatronix commented on GitHub (Oct 14, 2022):

Can you provide logs with esp debugging on ?

The esp core should be retrying these connections itself now.

<!-- gh-comment-id:1278949157 --> @tablatronix commented on GitHub (Oct 14, 2022): Can you provide logs with esp debugging on ? The esp core should be retrying these connections itself now.
Author
Owner

@kjyv commented on GitHub (Oct 21, 2022):

Also seeing this on ESP32 (ESP8266 works fine with same code and on latest WiFiManager commit) - AP mode works, I can choose a network. The saved credentials are then tried but no IP is received and the log says:

*wm:[1] AutoConnect 
*wm:[2] Setting Hostnames:  ***
*wm:[2] Setting WiFi hostname 
[   164][V][WiFiGeneric.cpp:341] _arduino_event_cb(): STA Stopped
[   166][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 3 - STA_STOP
[   185][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY
*wm:[2] ESP32 event handler enabled 
*wm:[   190][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started
[2] [   191][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START
Connecting as wifi client... 
*wm:[2] setSTAConfig static ip not set, skipping 
*wm:[1] Connect Wifi, ATTEMPT # 1 of 5
*wm:[1] Connecting to SAVED AP: **
[  1715][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
*wm:[2] 10000 ms timeout, waiting for connect...
*wm:[2] . 
(...)
*wm:[2] . 
[  3973][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: **, BSSID: *:*:*:*:*:*, Reason: 2
[  3974][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED
[  3981][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE
[  3987][D][WiFiGeneric.cpp:966] _eventCallback(): WiFi Reconnect Running

After the last retry, is also shows these lines:

E (61517) wifi:sta is connecting, return error
[ 48003][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007

I've tried this on multiple devices - some very rare times it did connect but pretty much all of the time it does not.
It also does not matter if I set WPA + WPA2, WPA2 only or no auth on the router.

<!-- gh-comment-id:1286951214 --> @kjyv commented on GitHub (Oct 21, 2022): Also seeing this on ESP32 (ESP8266 works fine with same code and on latest WiFiManager commit) - AP mode works, I can choose a network. The saved credentials are then tried but no IP is received and the log says: ``` *wm:[1] AutoConnect *wm:[2] Setting Hostnames: *** *wm:[2] Setting WiFi hostname [ 164][V][WiFiGeneric.cpp:341] _arduino_event_cb(): STA Stopped [ 166][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 3 - STA_STOP [ 185][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 0 - WIFI_READY *wm:[2] ESP32 event handler enabled *wm:[ 190][V][WiFiGeneric.cpp:338] _arduino_event_cb(): STA Started [2] [ 191][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 2 - STA_START Connecting as wifi client... *wm:[2] setSTAConfig static ip not set, skipping *wm:[1] Connect Wifi, ATTEMPT # 1 of 5 *wm:[1] Connecting to SAVED AP: ** [ 1715][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0 *wm:[2] 10000 ms timeout, waiting for connect... *wm:[2] . (...) *wm:[2] . [ 3973][V][WiFiGeneric.cpp:360] _arduino_event_cb(): STA Disconnected: SSID: **, BSSID: *:*:*:*:*:*, Reason: 2 [ 3974][D][WiFiGeneric.cpp:929] _eventCallback(): Arduino Event: 5 - STA_DISCONNECTED [ 3981][W][WiFiGeneric.cpp:950] _eventCallback(): Reason: 2 - AUTH_EXPIRE [ 3987][D][WiFiGeneric.cpp:966] _eventCallback(): WiFi Reconnect Running ``` After the last retry, is also shows these lines: ``` E (61517) wifi:sta is connecting, return error [ 48003][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007 ``` I've tried this on multiple devices - some very rare times it did connect but pretty much all of the time it does not. It also does not matter if I set WPA + WPA2, WPA2 only or no auth on the router.
Author
Owner

@tablatronix commented on GitHub (Oct 22, 2022):

Ok this is a slightly different issue, have you tried the aggressive recon mod above?

<!-- gh-comment-id:1287580181 --> @tablatronix commented on GitHub (Oct 22, 2022): Ok this is a slightly different issue, have you tried the aggressive recon mod above?
Author
Owner

@kjyv commented on GitHub (Oct 22, 2022):

It's already included by default, but also tried setting it to false

<!-- gh-comment-id:1287872690 --> @kjyv commented on GitHub (Oct 22, 2022): It's already included by default, but also tried setting it to false
Author
Owner

@tablatronix commented on GitHub (Oct 23, 2022):

oh yeah lol

<!-- gh-comment-id:1287991504 --> @tablatronix commented on GitHub (Oct 23, 2022): oh yeah lol
Author
Owner

@Robotto commented on GitHub (Oct 23, 2022):

Can you provide logs with esp debugging on ?

The esp core should be retrying these connections itself now.

Hm... While messing around trying to get debug output to work, i discovered that the ESP module is an ESP-12 and not an ESP-12E .. changed this and the issue seems to have vanished... (never got debug output to work)

<!-- gh-comment-id:1288181719 --> @Robotto commented on GitHub (Oct 23, 2022): > Can you provide logs with esp debugging on ? > > The esp core should be retrying these connections itself now. Hm... While messing around trying to get debug output to work, i discovered that the ESP module is an ESP-12 and not an ESP-12E .. changed this and the issue seems to have vanished... (never got debug output to work)
Author
Owner

@lyricnz commented on GitHub (Nov 24, 2024):

(Crossposting from closed issue)

FWIW I have the same symptom (connects every second boot, with 100% reliability). Adding the retries didn't help for me.

Connecting to WiFi
*wm:[2] AutoConnect 
*wm:[4] No Hostname to set 
*wm:[3] ESP32 event handler enabled 
*wm:[3] Connecting as wifi client... 
*wm:[4] STA static IP:
*wm:[3] setSTAConfig static ip not set, skipping 
*wm:[2] Connect Wifi, ATTEMPT # 1 of 3
*wm:[2] Connecting to SAVED AP: iot
*wm:[4] Using Password: REMOVED
*wm:[4] WiFi_enableSTA enable
*wm:[4] Mode after delay:  STA
*wm:[2] connectTimeout not set, ESP waitForConnectResult... 
*wm:[3] [EVENT] WIFI_REASON:  202
*wm:[3] [EVENT] WIFI_REASON:  202
*wm:[3] Connection result: WL_CONNECT_FAILED
*wm:[2] Connect Wifi, ATTEMPT # 2 of 3
*wm:[2] Connecting to SAVED AP: iot
*wm:[4] Using Password: REMOVED
*wm:[4] WiFi_enableSTA enable
*wm:[4] Mode after delay:  STA
*wm:[2] connectTimeout not set, ESP waitForConnectResult... 
*wm:[3] Connection result: WL_CONNECT_FAILED
*wm:[2] Connect Wifi, ATTEMPT # 3 of 3
*wm:[2] Connecting to SAVED AP: iot
*wm:[4] Using Password: REMOVED
*wm:[4] WiFi_enableSTA enable
*wm:[4] Mode after delay:  STA
E (8862) wifi:sta is connecting, return error
[  4270][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
*wm:[2] connectTimeout not set, ESP waitForConnectResult... 
*wm:[3] Connection result: WL_CONNECT_FAILED
*wm:[4] lastconxresulttmp: WL_STATION_WRONG_PASSWORD
*wm:[4] lastconxresult: WL_STATION_WRONG_PASSWORD
*wm:[2] AutoConnect: FAILED for  3654 ms
*wm:[3] Starting Config Portal 
*wm:[4] WiFi station disconnect 
*wm:[4] WiFi_enableSTA enable
*wm:[3] Disabling STA 
*wm:[3] Enabling AP 
*wm:[2] StartAP with SSID:  Info-Orbs_88
<!-- gh-comment-id:2496303466 --> @lyricnz commented on GitHub (Nov 24, 2024): (Crossposting from closed issue) FWIW I have the same symptom (connects every second boot, with 100% reliability). Adding the retries didn't help for me. ``` Connecting to WiFi *wm:[2] AutoConnect *wm:[4] No Hostname to set *wm:[3] ESP32 event handler enabled *wm:[3] Connecting as wifi client... *wm:[4] STA static IP: *wm:[3] setSTAConfig static ip not set, skipping *wm:[2] Connect Wifi, ATTEMPT # 1 of 3 *wm:[2] Connecting to SAVED AP: iot *wm:[4] Using Password: REMOVED *wm:[4] WiFi_enableSTA enable *wm:[4] Mode after delay: STA *wm:[2] connectTimeout not set, ESP waitForConnectResult... *wm:[3] [EVENT] WIFI_REASON: 202 *wm:[3] [EVENT] WIFI_REASON: 202 *wm:[3] Connection result: WL_CONNECT_FAILED *wm:[2] Connect Wifi, ATTEMPT # 2 of 3 *wm:[2] Connecting to SAVED AP: iot *wm:[4] Using Password: REMOVED *wm:[4] WiFi_enableSTA enable *wm:[4] Mode after delay: STA *wm:[2] connectTimeout not set, ESP waitForConnectResult... *wm:[3] Connection result: WL_CONNECT_FAILED *wm:[2] Connect Wifi, ATTEMPT # 3 of 3 *wm:[2] Connecting to SAVED AP: iot *wm:[4] Using Password: REMOVED *wm:[4] WiFi_enableSTA enable *wm:[4] Mode after delay: STA E (8862) wifi:sta is connecting, return error [ 4270][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007 *wm:[2] connectTimeout not set, ESP waitForConnectResult... *wm:[3] Connection result: WL_CONNECT_FAILED *wm:[4] lastconxresulttmp: WL_STATION_WRONG_PASSWORD *wm:[4] lastconxresult: WL_STATION_WRONG_PASSWORD *wm:[2] AutoConnect: FAILED for 3654 ms *wm:[3] Starting Config Portal *wm:[4] WiFi station disconnect *wm:[4] WiFi_enableSTA enable *wm:[3] Disabling STA *wm:[3] Enabling AP *wm:[2] StartAP with SSID: Info-Orbs_88 ```
Author
Owner

@melyux commented on GitHub (Dec 1, 2025):

This is still going on, every time the access point is rebooted. Doesn't happen on ESP8266, only ESP32. Also with UniFi APs

Nov 30 18:54:13 N: Attempting Wifi connection with saved AP: 0
Nov 30 18:54:13 E (10647253) wifi:sta is connecting, return error
Nov 30 18:54:14 [10629731][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
Nov 30 18:54:14 N: Attempting Wifi connection with saved AP: 1
Nov 30 18:54:14 E (10648264) wifi:sta is connecting, return error
Nov 30 18:54:15 [10630742][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
Nov 30 18:54:16 N: Attempting Wifi connection with saved AP: 2
Nov 30 18:54:16 N: Attempting Wifi connection with saved AP: 3
Nov 30 18:54:16 E (10650287) wifi:sta is connecting, return error
Nov 30 18:54:17 [10632765][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
Nov 30 18:54:17 N: Attempting Wifi connection with saved AP: 4
Nov 30 18:54:17 E (10651298) wifi:sta is connecting, return error
Nov 30 18:54:18 [10633776][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007
Nov 30 18:54:18 W: Network disconnected
<!-- gh-comment-id:3594100297 --> @melyux commented on GitHub (Dec 1, 2025): This is still going on, every time the access point is rebooted. Doesn't happen on ESP8266, only ESP32. Also with UniFi APs ``` Nov 30 18:54:13 N: Attempting Wifi connection with saved AP: 0 Nov 30 18:54:13 E (10647253) wifi:sta is connecting, return error Nov 30 18:54:14 [10629731][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007 Nov 30 18:54:14 N: Attempting Wifi connection with saved AP: 1 Nov 30 18:54:14 E (10648264) wifi:sta is connecting, return error Nov 30 18:54:15 [10630742][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007 Nov 30 18:54:16 N: Attempting Wifi connection with saved AP: 2 Nov 30 18:54:16 N: Attempting Wifi connection with saved AP: 3 Nov 30 18:54:16 E (10650287) wifi:sta is connecting, return error Nov 30 18:54:17 [10632765][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007 Nov 30 18:54:17 N: Attempting Wifi connection with saved AP: 4 Nov 30 18:54:17 E (10651298) wifi:sta is connecting, return error Nov 30 18:54:18 [10633776][E][WiFiSTA.cpp:317] begin(): connect failed! 0x3007 Nov 30 18:54:18 W: Network disconnected ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/WiFiManager#909
No description provided.