WIFI connection speed

clinnemann
Posts: 6
Joined: Sun Jul 09, 2023 7:57 pm

WIFI connection speed

Postby clinnemann » Sun Jul 09, 2023 8:11 pm

Hi everybody,

I am using ESP IDF together with an ESP32 WROVER module. The connection to my access point usually takes 3,7 seconds but sometimes only 250ms. The reason for the 3,7 seconds is that the first connection attempt fails (see hereunder - the so called WIFI_EVENT_STA_DISCONNECTED event raises). But the 2nd attempt always works.

The reason for the WIFI_EVENT_STA_DISCONNECTED event to get triggered is AUTH_EXPIRED (see picture). This means that the wifi credentials (which are correct) cannot be checked within the specified time. When this event is raised my function calls esp_wifi_connect to do a new connection attempt (copied from the ESP IDF examples). My impression is that there is an internal wait period of 2s within this function if the first attempt fails.

I have three questions:
a) Is it possible to alter the timeout for AUTH_EXPIRED?
b) Is it possible to reduce the internal wait period within esp_wifi_connect?
c) Do you have any other idea on how I can speed up things?

Thanks a lot for your help and effort!
Christian


if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_START)
{
esp_wifi_connect();
} else if (event_base == WIFI_EVENT && event_id == WIFI_EVENT_STA_DISCONNECTED)
{
wifi_event_sta_disconnected_t disconnect_event_data = *((wifi_event_sta_disconnected_t*) event_data);
last_wifi_disconnect_reason_code = disconnect_event_data.reason;
ESP_LOGI(TAG, "STA Disconnected Event with error code: %d", last_wifi_disconnect_reason_code);
if (s_retry_num < EXAMPLE_ESP_MAXIMUM_RETRY)
{
esp_wifi_connect();
s_retry_num++;
ESP_LOGI(TAG, "retry to connect to the AP");
} else
{
xEventGroupSetBits(s_wifi_event_group, WIFI_FAIL_BIT);
}
}

Who is online

Users browsing this forum: No registered users and 105 guests