ESP32 can connect to some Wifi 2.4Ghz networks except my home Wifi 2.4Ghz

spiffs_no_ota
Posts: 3
Joined: Wed Apr 13, 2022 5:57 am

ESP32 can connect to some Wifi 2.4Ghz networks except my home Wifi 2.4Ghz

Postby spiffs_no_ota » Tue Nov 14, 2023 4:10 am

I'm trying to use ESP32 to learn IoT. But I'm stuck at connecting ESP32 to my home Wifi.

First, I used Arduino 1.8.19 and Wifi Scan to scan my home network, it scanned my home network but cannot connect (I was sure ssid and password were correct). I changed ssid to my phone hotspot, it connected fine, I changed to my office network, it connected fine.
Next, I decide to use ESP-IDF with VSCode. I chose to use the ESP-IDF 5.1.1. I use wifi_station template. Same thing happened, I could connect to many 2.4 Ghz Wifi networks I knew except my home Wifi.
I knew my router was dual channel, so I turn off 5Ghz mode. Still no connection.
Worst thing was, my router could connect to other 2.4Ghz devices (old phones and computers) just fine.

I don't know why my router hate ESP32 so much :lol:
Please give me some idea on how to debug this. With current code (I'm using wifi_station as template), there isn't much information to diagnose. And throwing the router away is not a good option right now.

The code and the log are in the attachments.
station_example_main.c
(6.9 KiB) Downloaded 167 times
log.wifi_sample.20231111215608.txt
(6.11 KiB) Downloaded 166 times

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

Re: ESP32 can connect to some Wifi 2.4Ghz networks except my home Wifi 2.4Ghz

Postby mbratch » Fri Nov 17, 2023 8:33 pm

What are the differences between the AP configuration for your office network as compared to your home AP? For example, are the configured for the same encryption?

I would also suggest, in ESP-IDF, turn on the debug level logging. There are also some debug flags for wifi in particular, I think, in the sdkconfig. This may provide detail showing the specific reason for failure. I am not familiar with the wifi station template, but if it has implemented the wifi event handler, then in the handler, on disconnect, you can find the reason code in the data passed to the event handler and log that information. The reason codes are defined in one of the header files.

Who is online

Users browsing this forum: Google [Bot] and 277 guests