cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 FreeRTOS vs Bare metal performance

lorant124
Associate III

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 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
lorant124
Associate III

Issue solved.
The problem was caused by the RTOS kernel Awareness - RTOS Proxy being enabled, to see the thread properties during debugging. However, when switching from RTOS Proxy to J-Link, the performance issues were resolved immediately. But, of course, this requires J-Link.

lorant124_0-1697201222253.png

 


View solution in original post

1 REPLY 1
lorant124
Associate III

Issue solved.
The problem was caused by the RTOS kernel Awareness - RTOS Proxy being enabled, to see the thread properties during debugging. However, when switching from RTOS Proxy to J-Link, the performance issues were resolved immediately. But, of course, this requires J-Link.

lorant124_0-1697201222253.png