Why does WiFi.begin() take 3-4 attempts to connect?

davepl
Posts: 29
Joined: Wed Jun 27, 2018 5:29 pm

Why does WiFi.begin() take 3-4 attempts to connect?

Postby davepl » Sun Jun 20, 2021 4:17 pm

I see a lot of ASSOC_LEAVE, which I thought was load balancing, but once I added printing of the BSSID, I can see that each time it's the same nearby access point.

Does anyone know why it always takes me 3-4 attempts, over a total of about 10 seconds, to connect to the AP? It connects and then disconnects multiple times.

Thanks!
Dave


␛[0m[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 2 - STA_START
(I) (ConnectToWiFi)(C1) Setting host name to LEDWiFi...
␛[0m(I) (ConnectToWiFi)(C1) OK
␛[0m(I) (ConnectToWiFi)(C1) Attempting to connect to SSID of [IoTWiFi]
␛[0m(I)
␛[0m[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:419] _eventCallback(): STA IP: 192.168.8.235, MASK: 255.255.255.0, GW: 192.168.8.1
Connected to AP with BSSID: F2:63:DA:EA:6C:56
(I) (ConnectToWiFi)(C1) Attempting to connect to SSID of [IoTWiFi]
␛[0m(I)
␛[0mConnected to AP with BSSID:
(I) (ConnectToWiFi)(C1) Attempting to connect to SSID of [IoTWiFi]
␛[0m[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 8 - ASSOC_LEAVE
(I)
␛[0m[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:419] _eventCallback(): STA IP: 192.168.8.235, MASK: 255.255.255.0, GW: 192.168.8.1
Connected to AP with BSSID: F2:63:DA:EA:6C:56
(I) (ConnectToWiFi)(C1) Attempting to connect to SSID of [IoTWiFi]
␛[0m(I)
␛[0mConnected to AP with BSSID:
(I) (ConnectToWiFi)(C1) Attempting to connect to SSID of [IoTWiFi]
␛[0m(I)
␛[0m[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 5 - STA_DISCONNECTED
[W][WiFiGeneric.cpp:391] _eventCallback(): Reason: 8 - ASSOC_LEAVE
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 4 - STA_CONNECTED
[D][WiFiGeneric.cpp:374] _eventCallback(): Event: 7 - STA_GOT_IP
[D][WiFiGeneric.cpp:419] _eventCallback(): STA IP: 192.168.8.235, MASK: 255.255.255.0, GW: 192.168.8.1
Connected to AP with BSSID: F2:63:DA:EA:6C:56
(I) (ConnectToWiFi)(C1) Starting/restarting Socket Server...

User avatar
mbratch
Posts: 303
Joined: Fri Jun 11, 2021 1:51 pm

Re: Why does WiFi.begin() take 3-4 attempts to connect?

Postby mbratch » Thu Jul 01, 2021 2:33 am

This question is about an Arduino library, not a ESP-IDF library. You should post it in the Arduino discussion forum.

Who is online

Users browsing this forum: No registered users and 70 guests