Timer interrupt confusion for prescaler & counter period values
Hi,
I am working with STM32G4. I am using Timer1 for the hardware interrupt delay.
TImer1 works with APB2 clock -My APB2 clock is 48 MHz.
1.I need to generate timer with 50 usec delay.
What will be the prescaler and counter period.Can anyone suggest.
2.For testing I tested for 500 msec delay with
prescaler=12000-1
Counter period =2000=1
With above settings led should toggle for(500 msec on time/500 msec off time)
but led is toggling with 5 sec delay(2.5 sec on/2.5 sec off).
What am I doing wrong? can any one suggest.
HAL_TIM_Base_Start_IT(&htim1);
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
if (htim == &htim1)
{
HAL_GPIO_TogglePin(GPIOA, user_led);
}
}



Thanks
