AnsweredAssumed Answered

Update interrupt flag goes high as soon as counter is enabled

Question asked by Onkar Chincholkar on Jan 15, 2018
Latest reply on Jan 23, 2018 by Onkar Chincholkar

I am new to STM32 controllers and I wanted to create a sample code for counter in TIM1. I am facing a problem that the update interrupt flag, which is supposed to go high when counter equals ARR register, is going high as soon as counter is enabled. I am using discovery F0 board and giving a simplified version of my code


void main(void)
    TIM1->PSC = 0xff;
    TIM1->CNT &= 0x0;
    TIM1->ARR = 0xffff;
    Glow LED1
    TIM1->CR1 |= 0x0001;
    while(TIM_SR_UIF == 0);
    Turn off led


Thank you