cancel
Showing results for 
Search instead for 
Did you mean: 

Timer related general questions

aamirali641989
Associate II
Posted on July 31, 2013 at 12:33

1. What is total delay produced by timer in STM32f205:

delay =  (   (ARR+1) * (PSC+1) )  / Timer_freq               or 

delay =  (   (ARR) * (PSC+1) )  / Timer_freq                   or

delay =  (   (ARR) * (PSC) )  / Timer_freq              

2. I have a timer for 10ms, what is correct way of restarting the timer. After 5ms I stopped by timer by TIM2->CR1     &= (~0x0001). (due to some condition). After that I want to restart the timer for 10ms again, not for left 5 ms, is it the correct way

 TIM2->CNT     = 0x0000;  /* clear any previous cnt */          

 TIM2->EGR     = 0x0001;  // update register                            

 TIM2->CR1    |= 0x0001; //start
1 REPLY 1
Posted on July 31, 2013 at 14:15

delay =  (   (ARR+1) * (PSC+1) )  / Timer_freq 

Bit 7 (ARPE) of bit CR1, and Bit 0 (UG) of EGR would be the things I'd look at.

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