cancel
Showing results for 
Search instead for 
Did you mean: 

How to determine CPU load stm32h743?

Alex Golubev
Associate II

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?

1 REPLY 1
TDK
Guru

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".