Difference between revisions of "STM32 FreeRTOS Statistics"

From Stm32World Wiki
Jump to navigation Jump to search
Line 2: Line 2:
 
When developing applications which use [[FreeRTOS]] it can be quite unclear how much processing time is actually being used by each task.  Fortunately, FreeRTOS have the option of enabling task statistics.
 
When developing applications which use [[FreeRTOS]] it can be quite unclear how much processing time is actually being used by each task.  Fortunately, FreeRTOS have the option of enabling task statistics.
  
I was at some point messing around with [[DMA]] driven [[PWM]] (see [https://github.com/lbthomsen/blackpill/tree/master/dmapwm here]).
+
I was at some point messing around with [[DMA]] driven [[PWM]] (see [https://github.com/lbthomsen/blackpill/tree/master/dmapwm here]) on a [[Black Pill]] board. This particular example enables 3 tasks.  One task is toggling the built-in LED on PC13.  Two other tasks are updating the [[DMA]] buffers triggered by an interrupt call back.
 +
 
 +
== CubeMX Configuration ==
  
 
First step is to enable a timer.  The clock configuration is like this:
 
First step is to enable a timer.  The clock configuration is like this:
Line 15: Line 17:
  
 
[[File:CubeMX FreeRTOS Statistics Enabled.png|400px]]
 
[[File:CubeMX FreeRTOS Statistics Enabled.png|400px]]
 +
 +
== Code ==

Revision as of 02:17, 18 October 2021

When developing applications which use FreeRTOS it can be quite unclear how much processing time is actually being used by each task. Fortunately, FreeRTOS have the option of enabling task statistics.

I was at some point messing around with DMA driven PWM (see here) on a Black Pill board. This particular example enables 3 tasks. One task is toggling the built-in LED on PC13. Two other tasks are updating the DMA buffers triggered by an interrupt call back.

CubeMX Configuration

First step is to enable a timer. The clock configuration is like this:

96 MHz Timer Clock.png

In other words, the APB1 Timer Clock is running at 96 MHz. Configuring the timer with a counter period of 959 and no prescaler will result in an interrupt frequency of 100 kHz - or 100 interrupts every millisecond.

Timer for statistics.png

The final step is to enable the statistics in the FreeRTOS section of CubeMX:

CubeMX FreeRTOS Statistics Enabled.png

Code