Skip to main content
Associate III
December 28, 2023
Solved

Timer updates only after i set a breakpoint

  • December 28, 2023
  • 1 reply
  • 1684 views

I'm using an STM32F401RCT6 to create a very accurate millisecond timer for a school project. When the second interrupt of the alarm triggers i set a new CCR1 value and reset the timer. But it seems like the timer just ignores this. Only when i set a breakpoint in the function and resume it updates. Can anyone help me?

Everything else works, i get a square wave of 50%. But it just doesnt seem to update.

 

Hesseltjuuh_0-1703784283302.png

Hesseltjuuh_1-1703784292024.png

Hesseltjuuh_3-1703784392779.png

 

 

 

 

This topic has been closed for replies.
Best answer by waclawek.jan

Timer prescaler TIMx_PSC is unconditionally preloaded, it means, that the new value does not get into effect until the next Update (overflow) of the timer.

TIMx_CCRx may be preloaded, too; see TIMx_CCMRx.OCxPE.

JW

1 reply

waclawek.jan
waclawek.janBest answer
Super User
December 28, 2023

Timer prescaler TIMx_PSC is unconditionally preloaded, it means, that the new value does not get into effect until the next Update (overflow) of the timer.

TIMx_CCRx may be preloaded, too; see TIMx_CCMRx.OCxPE.

JW