STM32L4 FreeRTOS vs Bare metal performance
Hi,
I have an STM32L4x6 processor.
I'm reading data using ADC and DMA, and after the HAL_ADC_ConvCpltCallback, I process the data with a Fast Fourier Transform. Originally, in bare-metal, I had a flag in the main loop, and when the interrupt occurred, I set the flag and calculated the FFT(). My processor is currently running at 4MHz. The entire FFT operation took about 140-145ms (measured with HAL_GetTick()).
Afterward, I wanted to see the results with FreeRTOS. I created a task that starts when the flag is set to 1 by the HAL_ADC_ConvCpltCallback. However, when I measure it with osKernelGetTickCount(), the FFT function takes three times as long under FreeRTOS compared to bare-metal. I also tried giving the task a high priority and experimented with kernel_lock, but in all cases, it's about 480ms.
What could be causing this significant difference?
I also tried other tasks like memcpy and looped copying, and in all cases, the tasks take about three times as long under FreeRTOS.
Does anyone have any ideas?
Thank you :)

