cancel
Showing results for 
Search instead for 
Did you mean: 

STM32_F0 Changing Timer Period

daniel2
Associate II
Posted on February 09, 2015 at 20:32

Hi All,

I have a timer running on my STM32F0 and I would like to change the period of the timer mid-application. Do I need to rerun my timer configuration with the new timer period or can I simply update the single TIM_Period register. If so, how would I do that in my main application? Would this be acceptable just in main.c:

TIM16->ARR = UART_CAPTURE_PERIOD_EOC;

Thanks

1 REPLY 1
Posted on February 09, 2015 at 21:20

Yes, pretty much just by setting TIMx->ARR, normally the new value is used at the next update, as it moves the shadow register to the active one, or you can force it to preload immediately, but then you'd need to be more conscious of the current phase (TIMx->CNT) so as not to have a random phase hit where the current cycle is abruptly shortened.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..