Library 60- CPU load monitor for STM32F4xx devices

Yesterday, I’ve made a post about monitoring CPU load depending on CPU work and it’s sleep time using DWT counter. This post can be found here.

This post is now a library, set together from post about CPU load.



  • 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


    • STM32F4xx
    • STM32F4xx PWR
    • STM32F4xx
  • TM
    • defines.h

Functions and enumerations


Project is available on Github, download library below.



Owner of this site. Also electronic enthusiasts, web developer, 3D printer fan, handball player and more. Big fan of STM32F4 devices. In anticipation of the new Discovery board for STM32F7 lines.

You may also like...

Read before commenting!

Before you make a new comment, make sure you agree with things listed below:

  • - Read post to make sure if it is already posted what you are asking for,
  • - Make sure you have the latest version of libraries used in your project,
  • - Make a clean and grammatically correct written message,
  • - Report as many details as possible, including what have you done so far,
  • - Do NOT post any code here. Use Pastebin,
  • - Do NOT post any error codes here. Use Pastebin,
  • - Specify STM32Fxxx family and used Discovery/EVAL/Nucleo or custom made board,
  • - Make sure your clock is set correct for PLL,
  • - If you are using my HAL drivers, please check this post how to start.
Comment will be deleted on breaking these rules without notification!
  • Pingback: CPU load monitor for STM32F4xx - STM32F4 Discovery()

  • Jacob

    is it possible to read CPU voltage in program? It could improve ADC measurement for example.
    On my board Ucc varies between 2.8 V and 2.9 V. I get this information from voltmeter and ST-LINK Utility (Target->Settings: Target Voltage).

    • Voltage reference could be measured for adc as far I know. Must check reference manual for that but it is part of adc.

      Btw..cpu voltage is 1.25V 😀