Skip to main content
Alex Golubev
Associate III
May 21, 2021
Question

How to determine CPU load stm32h743?

  • May 21, 2021
  • 1 reply
  • 1224 views

Hi.

I need to estimate the cpu load and output the data as a percentage to a variable ram and to an LED. I use stm 32h 743. The microcontroller works without sleep. It is advisable to make accounting and interruptions. Can you suggest a solution?

This topic has been closed for replies.

1 reply

TDK
May 21, 2021

One way is to use a software counter. Pseudocode:

volatile uint32_t x = 0;
uint32_t start_tick = TICKS;
while (last_tick - TICKS < DURATION) {
 ++x;
}

Run that under idle conditions to establish a baseline, then run it under load conditions with other interrupts happening. Under 50% load, your final value for x will be half of the idle/baseline value.

"If you feel a post has answered your question, please click ""Accept as Solution""."