HAL Library 19- CPU LOAD monitor for STM32Fxxx

CPU load monitor library is simple library, which counts number of sleeping cycles using WFI() instruction compared to working cycles in one second.

Load variable is updated every 1 second to determinate how much your processor works. For that case, you have to always put your system to sleep mode when you don’t need it.

It uses DWT counter in Cortex M4/M7 to measure cycle counters!


Read more about new HAL libraries


  • Measures CPU load. Load depends between sleep time and work time of CPU
  • CPU load is updated for every System core clock cycles. In other words, that is each 1 second
  • DWT counter used for measurements
  • Sleep mode which is measured can be wait for interrupt or wait for event


  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h

Functions and enumerations


Project is available on Github, download library below.


Owner of this site. Application engineer, currently employed by STMicroelectronics. Exploring latest technologies and owner of different libraries posted on Github.

You may also like...