AnsweredAssumed Answered

Simple Timer TIM7 "update event"

Question asked by smith.gene on Jun 12, 2014
Latest reply on Jun 12, 2014 by smith.gene
Why do I get an immediate update event when I configure TIM7 like this:
TIM7->CR1 = 0;
TIM7->PSC = 7199;
TIM7->ARR = 2000;
TIM7->DIER = 0;
TIM7->CNT = 0;
 
TIM7->CR1 = TIM_CR1_CEN;
while ((TIM7->SR & TIM_SR_UIF) != TIM_SR_UIF)
{
    if (TIM7->CNT > 1)
    {
        break;
    }
}
TIM7->CR1 = 0;
TIM7->SR = 0;
I see the update event as soon as it enters the loop. I would think the count would reach 2000 before the UIF bit in SR would become set.  Why do I get an almost immediate update event?

Thanks,
Gene

Outcomes