Hi -
I'm writing an app that when on battery power, it starts wifi, connects, sends a status message, and then disconnects and stops wifi. It does this once a minute.
A few iterations in, my attempt at connecting results in a disconnect event with a reason code WIFI_REASON_ASSOC_TOOMANY. My program seems to get stuck once it's gotten this event.
- too many of what?
- what am I doing to cause this?
Additional information: I do notice that after the first iteration of this cycle, I get a lost IP message about 15 seconds after the stop. (This is fine because I restart wifi every time.) The second cycle, I get this message about 30 seconds after the stop. I'm wondering whether this has something to do with the problem I'm having, though I can't quite connect the dots on this one.
Thanks.
cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Although I have no idea on the underlying puzzle, I could image a couple of questions I may ask:
1. How are you disconnecting?
2. Are you waiting for a confirmation of a disconnect?
3. How are you stopping WiFi?
1. How are you disconnecting?
2. Are you waiting for a confirmation of a disconnect?
3. How are you stopping WiFi?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Hi Neal -
I'm using the esp_wifi_disconnect() and esp_wifi_stop() routines. And no, I'm not waiting for confirmation of the disconnect; I'm not sure how to do that.
I'm using the esp_wifi_disconnect() and esp_wifi_stop() routines. And no, I'm not waiting for confirmation of the disconnect; I'm not sure how to do that.
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Within the WiFi subsystem there is the concept of an event handler. The event handler is a function that you register which is invoked behind the scenes by the WiFi subsystem. It is typically used to inform you of WiFi lifecycle events. There are many events that can occur. Two of them might be of interest to us. The first is:
* SYSTEM_EVENT_STA_DISCONNECTED
This event is raised following a call to esp_wifi_disconnect(). We should assume that the esp_wifi_disconnect() call is an asynchronous API call. This means is that when you call it and it returns, you have NOT been disconnected .. rather you have issued a request to be eventually disconnected. You will know when you have actually been disconnected when the SYSTEM_EVENT_STA_DISCONNECTED event is received. Similarly, if you call esp_wifi_stop(), you will not have actually stopped the WiFi subsystem but merely sent a request to stop the subsystem. You should expect to receive an event of type:
* SYSTEM_EVENT_STA_STOP
* SYSTEM_EVENT_STA_DISCONNECTED
This event is raised following a call to esp_wifi_disconnect(). We should assume that the esp_wifi_disconnect() call is an asynchronous API call. This means is that when you call it and it returns, you have NOT been disconnected .. rather you have issued a request to be eventually disconnected. You will know when you have actually been disconnected when the SYSTEM_EVENT_STA_DISCONNECTED event is received. Similarly, if you call esp_wifi_stop(), you will not have actually stopped the WiFi subsystem but merely sent a request to stop the subsystem. You should expect to receive an event of type:
* SYSTEM_EVENT_STA_STOP
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Oh yes, of course...I didn't realize you were talking about the event handler. My worker tasks waits for a DISCONNECTED event before setting a local state variable. I don't wait for the STA_STOP event, but...I wouldn't think that I need to, as I only attempt a reconnect once a minute.
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Anyone have any ideas on this one? I need to get this fixed.
Thanks...
Thanks...
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
Good luck. When using WPA2 I get a random amount of WIFI_REASON_ASSOC_FAIL errors trying to connect. Can't get an answer on that either. There is no source to look at, and no explanation of the defines.
John A
John A
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
BTT. This is an ongoing problem, and I really don't know how to recover from receiving this code.
Re: cause and cure for WIFI_REASON_ASSOC_TOOMANY?
I have encountered the same problem. In ESP-IDF V5.1
Who is online
Users browsing this forum: No registered users and 127 guests