Page 1 of 1

ESP32 wifi scan not finding SSID [solved]

Posted: Wed Jul 11, 2018 1:47 pm
by PeterR
I have tried 'simple_wifi', 'scan' and 'wpa2_enterprise' on ESP-WROVER-KIT and ESP-EVB.
I cannot see the devices SSID. Scan does not find any SSIDs and so not unsurprisingly 'wpa2_enterprise' does not connect, instead periodically reporting DISCONNECTED.

My phone can see at least 4 networks. The network I am trying to access is WPA2-PSK.

Not sure how I can get 'make flash monitor' wrong!

Re: ESP32 wifi

Posted: Wed Jul 11, 2018 2:14 pm
by PeterR
My bad, finger trouble with the SSID.

Re: ESP32 wifi

Posted: Wed Jul 11, 2018 10:40 pm
by fly135
When you get the disconnect you can print the reason code.

system_event_sta_disconnected_t *disconnected;
...
case SYSTEM_EVENT_STA_DISCONNECTED:
disconnected = &event->event_info.disconnected;
eprintf(eLOG_WARNING,"SYSTEM_EVENT_STA_DISCONNECTED, ssid:%s, ssid_len:%d, bssid:" MACSTR ", reason:%d\n", \
disconnected->ssid, disconnected->ssid_len, MAC2STR(disconnected->bssid), disconnected->reason);

The reason codes are in .../components/esp32/include/esp_wifi_def.h

I have found that connecting to a WPA2 (not WPA/WPA2) results in a random number of disconnects before it finally connects and get the DHCP address.

I posted a question about it in the general forum but got no response. I'd be curious to know if you see these random number of disconnects with reason code 203 when talking to a WPA2 router.

John A

Re: ESP32 wifi scan not finding SSID [solved]

Posted: Fri Jul 13, 2018 11:28 am
by PeterR
Sure, will report when I have a view of Wifi disconnections and/or access issues.
The issue this time was a mistyped SSID. So the software was correct in periodically reporting DISCONNECTED (instead of disconnecting).

Working through the libwebsockets now as I cannot get reliable ethernet from the Olimex ESP32-EVB

Re: ESP32 wifi scan not finding SSID [solved]

Posted: Fri Jul 13, 2018 1:11 pm
by jcsbanks
One problem I'm having is that if I have multiple access points with the same SSID, password and security (as my network does with 4 access points because stone walls), is that the ESP32 unless I specify a channel will connect to one of the weaker ones with a lower channel number, and if I specify the channel number and it changes that is also a problem. I couldn't find a method yet to connect to the strongest signal or to hope between them.

Re: ESP32 wifi scan not finding SSID [solved]

Posted: Fri Jul 13, 2018 2:50 pm
by vonnieda
jcsbanks wrote:One problem I'm having is that if I have multiple access points with the same SSID, password and security (as my network does with 4 access points because stone walls), is that the ESP32 unless I specify a channel will connect to one of the weaker ones with a lower channel number, and if I specify the channel number and it changes that is also a problem. I couldn't find a method yet to connect to the strongest signal or to hope between them.
Use BSSID. BSSID is the MAC address of the AP and it never changes. It's returned in a site scan, along with RSSI, so you can pick the one with the best RSSI and then connect directly using the BSSID.

Jason

Re: ESP32 wifi scan not finding SSID [solved]

Posted: Fri Jul 13, 2018 4:35 pm
by fly135
PeterR wrote:Sure, will report when I have a view of Wifi disconnections and/or access issues.
The issue this time was a mistyped SSID. So the software was correct in periodically reporting DISCONNECTED (instead of disconnecting).
Yep, I saw that you had already figured it out. I was just letting you know that you can get the reason for the disconnect in the event handler. Partly self serving because I would like to know if others are seeing disconnect error code 203 when using WPA2-PSK (not WPA). That error doesn't prevent connecting. But it does result in a random number of disconnects before finally establishing a connection.
PeterR wrote:Working through the libwebsockets now as I cannot get reliable ethernet from the Olimex ESP32-EVB
Reliable Ethernet is IMO ESP32's biggest problem. We are seeing lots of dropped packets and very unreliable operation. When you get into environments like commercial buildings or apartment complexes that are full of wifi routers, it almost becomes unusable.

Re: ESP32 wifi scan not finding SSID [solved]

Posted: Fri Aug 03, 2018 6:32 pm
by mzimmers
So, on the subject of reason codes...what does WIFI_REASON_ASSOC_TOOMANY mean? I could guess, but I'd rather know for sure. I haven't found the explanation in the online docs.

(Note: I found this in esp_wifi_types.h.)