Hey all,
I have my loop() function reading from UART2 and updating an SSD1306 OLED through I2C. This works fine and takes approximately ~35ms. However, when enabeling the loop() task seems to get pre-empted becuase when WiFi is connecting the loop() sometimes takes around 700ms instead of 35ms!
I was under the assumption that the application core (where loop() is running) is not used by any other tasks at all. I also plan to run another task on the application core for audio playback, but if the wifi task or other tasks can interfere this might become problematic.
How can I ensure I have the entire application cpu core to myself?
wifi task interfering with loop() task on app core?
Re: wifi task interfering with loop() task on app core?
Are you sure you're not doing anything that might be waiting for a WiFi event? I would be looking out especially for something like this in loop():
If you share your code here we might be able to spot the cause.
Code: Select all
while (WiFi.status() != WL_CONNECTED)
Re: wifi task interfering with loop() task on app core?
No I'm not doing anything like that in my code. I tried profiling the code inside the loop function using millis() and whenever the entire loop() function took longer than 50ms I would have it print out the time it took for each of those sections so I could get to the part causing the delay. But sometimes the LCD function would take a long time to execute and other times it was the Serial code and sometimes it the loop took well over 700ms but the sections reported that they finished executing well within 50ms, which leads me to believe that the looptask was getting pre-empted to run a higher priority task.boarchuz wrote: ↑Mon Sep 16, 2019 2:12 pmAre you sure you're not doing anything that might be waiting for a WiFi event? I would be looking out especially for something like this in loop():
If you share your code here we might be able to spot the cause.Code: Select all
while (WiFi.status() != WL_CONNECTED)
Re: wifi task interfering with loop() task on app core?
Assuming you are not running RTOS, the default core where Arduino code will run is on core 1. Core 0 is where the WiFi will run so it will not interfere with your code. As mentioned, post the code so can help you debug
Who is online
Users browsing this forum: No registered users and 107 guests