esp-idf: [TW#19862] esp_wifi_connect() returns ESP_OK, but no system event posted (ap_loss) (IDFGH-6625)

I have found a situation where esp_wifi_connect() returns ESP_OK but no system event is emitted. This makes it impossible to know if the connection attempt is complete and has succeeded or failed.

I have documented the problem at https://esp32.com/viewtopic.php?f=2&t=5183

Here is a sample project that runs on any dev board that demonstrates the issue. It includes a README.md that explains how to set up the test.

ap_loss.zip

In short, if you attempt to connect to an known network with a bad password, get a SYSTEM_EVENT_STA_DISCONNECTED, then try to connect to an unknown network you will never get a system event and on the console you will see wifi: ap_loss.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 17 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Apologies for posting on a closed item, but I found this while searching for a solution to why esp_wifi_connect wouldn’t connect properly despite wifi_config_t.ssid and password being correct. I found that while setting the wifi_config_t using esp_wifi_set_config, that the wifi_config_t var went out of scope shortly after setting config. This caused the config in nvs to be incorrect, and would not connect to wifi. This may help someone in the future.