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!

Library

Read more about new HAL libraries

Features

  • 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

Dependencies

  • HAL
  • TM
    • STM32Fxxx HAL
    • defines.h

Functions and enumerations

Example

Project is available on Github, download library below.

Icon
TM STM32 Libraries

STM32 libraries based on STM32Fxxx HAL drivers.

tilz0R

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!