GUI updates interefere with realtime activity

I have a multi core ESP32C module I’m using as a closed loop PWM brushed motor controller with a nice LVGL status display.
For some odd reason when the GUI updates (I have a series chart which shows the PID error) it interferes with the PID routine. If I stop the graph updates the motor control is very smooth.
I have tried tons of things; portENTER_CRITICAL(&myMutex);, creating a separate high priority rtos process for the interrupt handler, hardware filtering, swapping out the ESP board for another one - nothing makes any difference.
Any idea what might be going on?

Update to my own issue: it seems to have to do with the TFT_eSPI routines and has nothing to do with LVGL itself.
It’s still a mystery as to why SPI transmissions are at all affecting my PWM and interrupts. I think it might be related to the HAL mutex “hanging” the processor. It’s definitely far worse when I reduce the TFT SPI_FREQUENCY.
I’ll update if and when I find the cause.

Ok this is embarrassing. One of the values I was using in the Interrupt Service Routine was being updated in loop(). This task has highly variable latency which is to be expected.
I moved the update into the ISR and all is great now.
I was thinking about deleting this posting but maybe it can help someone else with a similar issue.

Happy that you found the issue! :slight_smile:

I agree to keep this post as it can be helpful for others too.