I have an audio streaming client running on ESP32-C3 and I have optimized all the buffers and even have the IRAM optimizations for TCP-IP and WIFI in sdk_config. My problem is that when I put the internet radio receiver into a difficult wifi environment, I seem to completely lose control of it. I have a regularly updating task that VTaskDelays for 100 milliseconds and normally is fine, and with priority set to 23 which is the same priority as WiFi's free-RTOS priority. TCP-IP is only set at 18 which is a lower FreeRTOS priority.
Is there way to break into the wifi stack and to tell it to give up after 2 seconds of nothing? It is just completely blocking everything else at the moment, and I need some kind of timeout callback or any means of killing the existing TCP socket (which I normally do at the application layer) when it takes too long.
WiFi or TCP-IP Blocking high priority FreeRTOS tasks for over 10 seconds
-
- Posts: 20
- Joined: Tue Oct 24, 2023 10:11 pm
-
- Posts: 20
- Joined: Tue Oct 24, 2023 10:11 pm
Re: WiFi or TCP-IP Blocking high priority FreeRTOS tasks for over 10 seconds
Nevermind I solved it - it is the .timeout_ms field in esp_http_client_config_t which determines how long the TCP-IP is allowed to block everything else
Re: WiFi or TCP-IP Blocking high priority FreeRTOS tasks for over 10 seconds
Good find!
Do you know what the default is for the `.timeout_ms` setting? I couldn't find it in the documentation for `esp_http_client_config_t`
Do you know what the default is for the `.timeout_ms` setting? I couldn't find it in the documentation for `esp_http_client_config_t`
-
- Posts: 20
- Joined: Tue Oct 24, 2023 10:11 pm
Re: WiFi or TCP-IP Blocking high priority FreeRTOS tasks for over 10 seconds
In ADF they seem to set it at 30,000 milliseconds (or 30 seconds) and that's done when the client is initialized. The original ADF coder does the HTTP Client initialize like this:
esp_http_client_config_t http_cfg = {
.url = uri,
.event_handler = _http_event_handle,
.user_data = self,
.timeout_ms = 30 * 1000,
.buffer_size = HTTP_STREAM_BUFFER_SIZE, // originally 5120 bytes
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
.buffer_size_tx = 1024,
#endif
.cert_pem = http->cert_pem,
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) && defined CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
.crt_bundle_attach = http->crt_bundle_attach,
#endif // (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) && defined CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
.user_agent = http->user_agent,
};
http->client = esp_http_client_init(&http_cfg);
esp_http_client_config_t http_cfg = {
.url = uri,
.event_handler = _http_event_handle,
.user_data = self,
.timeout_ms = 30 * 1000,
.buffer_size = HTTP_STREAM_BUFFER_SIZE, // originally 5120 bytes
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 1, 0)
.buffer_size_tx = 1024,
#endif
.cert_pem = http->cert_pem,
#if (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) && defined CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
.crt_bundle_attach = http->crt_bundle_attach,
#endif // (ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 3, 0)) && defined CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
.user_agent = http->user_agent,
};
http->client = esp_http_client_init(&http_cfg);
Who is online
Users browsing this forum: No registered users and 196 guests