STA disconnecting

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

STA disconnecting

Postby imtiaz » Thu Feb 02, 2017 10:47 pm

Hi,

Does anyone know why my STA keeps disconnecting after a while with the following message:

D (4600228) event: SYSTEM_EVENT_STA_DISCONNECTED, ssid:esp32rover, ssid_len:10, bssid:24:0a:c4:04:79:d9, reason:4<27>[0m<\r><\n>
<27>[0;32mI (4600240) wifi: SYSTEM_EVENT_STA_DISCONNECTED<\r><\n>

reason = 4

I need a permanent connection .

Thanks
imtiaz

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: STA disconnecting

Postby kolban » Thu Feb 02, 2017 11:14 pm

The reason code being returned (numeric value 4) seems to mean : WIFI_REASON_ASSOC_EXPIRE

Doing a search of the ESP32 ESP-IDF github for that code doesn't return any source ... and I think that is because the WIFI engine is supplied in compiled library form only. So for now, that leaves us a little bling and we will likely have to hear back from Espressif designers.

Another possible plan of examination is to look at the English text ... "ASSOC_EXPIRE" ... when the ESP32 connects to an access point, we should imagine that it forms an "association" which might be what "ASSOC" means. That association is likely to be along the lines of "Hello access point, I would like you to be my access point and I will be one of your stations" ... once that association is made there is a relationship between the two. If we now look at the next part of the message "EXPIRE" ... that seems to say that the association has a finite life span and that after that life-span has passed, the relationship agreement is terminated ... by expiry. This would then speak to two possible resolution areas:

1. An ability to specify when the association is formed a longer expiry interval (possibly indefinitely)
2. A renewal of the relationship before expiry

It may be that some of these settings are owned not by the ESP32 but by the other end of the association ... the WIFI access point. It may be that it has to be configured with notions such as "maximum station connection duration" or "maximum idle time before association disconnect". There may also be idle time considerations here.

In your application, is there any traffic periodically going on that would indicate liveness between the two devices?

Is there a measurable time period from when the ESP32 becomes a station to the access point to when it is disconnected? If we saw a value here, that might also give us a clue.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

imtiaz
Posts: 106
Joined: Wed Oct 26, 2016 1:34 am

Re: STA disconnecting

Postby imtiaz » Thu Feb 02, 2017 11:29 pm

around 5 minutes of inactivity before it disconnects. Both STA and AP are running on an ESP - I just dont see where I can set a timeout etc.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 84 guests