ESP32-S3 - WiFi task causing incorrect FreeRTOS timer interrupt exec?
Posted: Wed Mar 29, 2023 2:45 pm
Device: ESP32-S3
IDF Version 5.0.1
Issue:
My main code task runs some routines with an external radio, and I'm using a FreeRTOS timer to set timeouts for command responses. I start my WiFi task (which immediately connects to a network) and my main task simultaneously, and I am noticing that very often my main state machine fails because my timer interrupt (for timeout) is executing prematurely at the incorrect time.
I set up a debug print in the RTOS timer handler, and I notice that whenever this happens (timer handler executing prematurely), it's immediately following an action in the WiFi task (IDF's built-in code, not mine): "wifi:state: init -> auth (b0)"
Increasing the timer task's or any other task's stack size has no effect. But what I *did* find is that if I pin the built-in WiFi task (through menuconfig) to Core 1 instead of the default Core 0, this issue goes away.
How in the world could Espressif's WiFi code be interfering with FreeRTOS's timer task (or interrupt handling)? And how could pinning the WiFi task to the app core be changing/remedying this behavior? I welcome any thoughts, things to try, solutions, or promised bug fixes!
Thanks,
Tony
IDF Version 5.0.1
Issue:
My main code task runs some routines with an external radio, and I'm using a FreeRTOS timer to set timeouts for command responses. I start my WiFi task (which immediately connects to a network) and my main task simultaneously, and I am noticing that very often my main state machine fails because my timer interrupt (for timeout) is executing prematurely at the incorrect time.
I set up a debug print in the RTOS timer handler, and I notice that whenever this happens (timer handler executing prematurely), it's immediately following an action in the WiFi task (IDF's built-in code, not mine): "wifi:state: init -> auth (b0)"
Increasing the timer task's or any other task's stack size has no effect. But what I *did* find is that if I pin the built-in WiFi task (through menuconfig) to Core 1 instead of the default Core 0, this issue goes away.
How in the world could Espressif's WiFi code be interfering with FreeRTOS's timer task (or interrupt handling)? And how could pinning the WiFi task to the app core be changing/remedying this behavior? I welcome any thoughts, things to try, solutions, or promised bug fixes!
Thanks,
Tony