AnsweredAssumed Answered

Configuration timer interrupt 1ms

Question asked by satour.abou on Jun 3, 2015
Latest reply on Jun 3, 2015 by Clive One
hello,
I use the stm32f103VD,
Clock 48MHz from the 8MHz HSI.

Can you help me and tell me if I configured the timer 3 correctly for counter each 1ms ?
I am not sure it's correct because the iterruption comes each 0.000999 ms ! I didn't understand why. any help plz ?

the code:    
//enable the timer clock
    RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
    //compute the prescaler value
    PrescalerValue = (uint16_t) (SystemCoreClock / 1000000) - 1;
    //time base configuration
    TIM_TimeBaseStructure.TIM_Period = 1 * 1000;
    TIM_TimeBaseStructure.TIM_Prescaler = PrescalerValue;
    TIM_TimeBaseStructure.TIM_ClockDivision = 0;
    TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
    TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure);
    //enable timer interrupt
    TIM_ITConfig(TIM3, TIM_IT_Update, ENABLE);
    //enable timer counter
    TIM_Cmd(TIM3, ENABLE);

thanks

Outcomes