Question
Hi all, I am back with another problem!! I am using timer 2 in 103C8 controller for 0.1 Sec time delay. However, it is generating 5 times the calculated delay. My initialization code for this delay is given below. Timer interrupt is enabled.
htim2.Init.Prescaler = 1000;
htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
htim2.Init.Period = 7200;
htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
htim2.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_ENABLE;
However if I change the prescaler to 200, I get the correct delay.
HAL_RCC_GetPCLK1Freq () function returns 36 MHz. Timer 2 clock source, which is APB1 will be 72 MHz. Where am I making a mistake? Thank you for your time.
