Hi all,
Can someone tell me what "wifi: ap_loss" logged on the console means? I am getting this message once in a while when trying to connect to an AP that is not available, and when I do, I do not get a SYSTEM_EVENT_STA_DISCONNECTED event.
To expand: I'm trying to make sure I always maintain a WiFi connection. I have several networks configured and I loop through them, trying each one. Normally, when I call esp_wifi_connect() I soon get either SYSTEM_EVENT_STA_CONNECTED or SYSTEM_EVENT_STA_DISCONNECTED. But once in a while I see "wifi: ap_loss" and do not get SYSTEM_EVENT_STA_DISCONNECTED.
My ultimate goal is to know that if I call esp_wifi_connect() I get *something* to tell me that the connection has either succeeded or failed. Right now I cannot determine how to do that reliably. Is there a way?
Thanks,
Jason
What is wifi: ap_loss? Where is SYSTEM_EVENT_STA_DISCONNECTED?
Re: What is wifi: ap_loss? Where is SYSTEM_EVENT_STA_DISCONNECTED?
Howdy Jason,
Unfortunately I have no technical knowledge to add but I would personally be dissapointed to make an esp_wifi_connect() API call and get no event back as a result. Some loose thoughts that might spark something in your mind.
1. Check the return code from the original call to esp_wifi_connect(). If this is anything other than ESP_OK then I would not expect an event to be returned. A failure to initiate the contract/protocol should mean that all bets are off.
2. In your event handler, have a go at logging every event that is returned. Just maybe we will see an event that is neither SYSTEM_EVENT_STA_CONNECTED or SYSTEM_EVENT_STA_DISCONNECTED.
Let us also sift to look through patterns where your scenario shows up. We will also want to validate that you are running the latest version of the ESP-IDF.
After performing the esp_wifi_connect() what does your logic do next? I want to validate that we aren't then doing something that could perturb the connection protocol/story.
Unfortunately I have no technical knowledge to add but I would personally be dissapointed to make an esp_wifi_connect() API call and get no event back as a result. Some loose thoughts that might spark something in your mind.
1. Check the return code from the original call to esp_wifi_connect(). If this is anything other than ESP_OK then I would not expect an event to be returned. A failure to initiate the contract/protocol should mean that all bets are off.
2. In your event handler, have a go at logging every event that is returned. Just maybe we will see an event that is neither SYSTEM_EVENT_STA_CONNECTED or SYSTEM_EVENT_STA_DISCONNECTED.
Let us also sift to look through patterns where your scenario shows up. We will also want to validate that you are running the latest version of the ESP-IDF.
After performing the esp_wifi_connect() what does your logic do next? I want to validate that we aren't then doing something that could perturb the connection protocol/story.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: What is wifi: ap_loss? Where is SYSTEM_EVENT_STA_DISCONNECTED?
Hi kolban,kolban wrote:Howdy Jason,
Unfortunately I have no technical knowledge to add but I would personally be dissapointed to make an esp_wifi_connect() API call and get no event back as a result. Some loose thoughts that might spark something in your mind.
1. Check the return code from the original call to esp_wifi_connect(). If this is anything other than ESP_OK then I would not expect an event to be returned. A failure to initiate the contract/protocol should mean that all bets are off.
2. In your event handler, have a go at logging every event that is returned. Just maybe we will see an event that is neither SYSTEM_EVENT_STA_CONNECTED or SYSTEM_EVENT_STA_DISCONNECTED.
Let us also sift to look through patterns where your scenario shows up. We will also want to validate that you are running the latest version of the ESP-IDF.
After performing the esp_wifi_connect() what does your logic do next? I want to validate that we aren't then doing something that could perturb the connection protocol/story.
Thank you for your response!
To answer your questions:
1. I check all return codes and none are errors.
2. I do log every event, and I also log the default case, just in case I miss something. There are no unhandled or unexpected events.
I am running IDF as of yesterday, Git hash: 2935e958fc4b43c90550364d76ae8f0a3cb8488d
Instead of describing my somewhat complicated connection process, I've produced a simple test case for this issue, attached below. I've run this on my custom hardware and on a WROVER-KIT-V3 and both produce the same results. I've included a README.md with details on the issue.
Thanks,
Jason
- Attachments
-
- ap_loss.zip
- (7.75 KiB) Downloaded 464 times
Who is online
Users browsing this forum: Majestic-12 [Bot] and 75 guests