esp_wifi_connect() does not yield to other tasks?
Posted: Tue Jun 05, 2018 11:05 am
I have a task called task_RMT_Rx that regularly flushes an RMT receive buffer that records pulse width hi/lo pairs. Because my hi/lo pairs are continuous, I have to do this as no interrupt can be called. If task_RMT_Rx is not run often enough, the RMT buffer overflows and I have to do a rather clumsy reset of all RMT channels rather than just the one that has overflowed.
When I do esp_wifi_connect, the RMT buffer overflows. If I wait 5000ms after calling esp_wifi_connect before starting the task_RMT_Rx, all behaves well, but I want to handle the situation so that WiFi can start and stop and not upset RMT.
This works:
This does not work:
I am suspicious that my task is not being run whilst esp_wifi_connect occurs. Is this expected/by design? I thought that WiFi would be on one core and my application on another and have no such problems, but I'm missing something.
I am going to investigate esp_wifi_connect code, but am still getting used to freeRTOS and how to properly get tasks to yield without introducing too much latency but also avoiding watchdog warnings. I am wondering if I need to do an HRT callback instead of a freeRTOS task to be certain my task_RMT_Rx will run reliably.
When I do esp_wifi_connect, the RMT buffer overflows. If I wait 5000ms after calling esp_wifi_connect before starting the task_RMT_Rx, all behaves well, but I want to handle the situation so that WiFi can start and stop and not upset RMT.
This works:
Code: Select all
ESP_ERROR_CHECK( esp_wifi_connect() );
vTaskDelay(5000);
xTaskCreate(task_RMT_Rx, "RMTFFS", 2048, NULL, 5, NULL);
Code: Select all
xTaskCreate(task_RMT_Rx, "RMTFFS", 2048, NULL, 5, NULL);
ESP_ERROR_CHECK( esp_wifi_connect() );
I am going to investigate esp_wifi_connect code, but am still getting used to freeRTOS and how to properly get tasks to yield without introducing too much latency but also avoiding watchdog warnings. I am wondering if I need to do an HRT callback instead of a freeRTOS task to be certain my task_RMT_Rx will run reliably.