AnsweredAssumed Answered

Unable to vary timer overflow time

Question asked by ANNU CHERIAN on Feb 15, 2018
Latest reply on Feb 15, 2018 by waclawek.jan

We are using stm32f051r4t6 IC for a new project  and IDE used is Keil V5 . We are using Timer_3 running at 8MHz internal clock to generate a timer delay but , by varying PSC and ARR registers we always obtain nearly 4us .  How could we vary the timer overflow time . Any help would be greatly appreciated .

 

 

 

void Timer3_Init()
{

    RCC->APB1ENR |= RCC_APB1ENR_TIM3EN;                                                                                                        
    TIM3->ARR = 0xFFFF;                                                                            
    TIM3->PSC = 0x0000;                                                                   
    TIM3->EGR |= TIM_EGR_UG;

    TIM3->CR1 |= TIM_CR1_ARPE  | TIM_CR1_CEN;   

    

   TIM3->DIER |= TIM_DIER_UIE; 

    NVIC_EnableIRQ(TIM3_IRQn); 
}

 

 

void TIM3_IRQHandler(void)
{
    if((TIM3->SR & TIM_SR_UIF))
    {
        TIM3->SR &=~ TIM_SR_UIF;
        TIM3->EGR |= TIM_EGR_UG;
      

        // toggle gpio pin
    }

}

Outcomes