Question
TIMER Update Event Not Affected from Changing CLOCK DIVISION Value
Posted on June 29, 2017 at 00:14
Hi. I use Keil Compiler and HAL lib. I configure TIM4 as normal timer (time base counter) and implement Update event with HAL_TIM_PeriodElapsedCallback function. My initialization code below;
__HAL_RCC_TIM4_CLK_ENABLE();
TIM4_Handler.Instance=TIM4; TIM4_Handler.Init.Prescaler=16000; // 16 MHZ/16000 = 1000 Hz -> 1 ms inc/dec period TIM4_Handler.Init.CounterMode=TIM_COUNTERMODE_UP; TIM4_Handler.Init.Period=1000; // 1msec x 1000 = 1 sec overflow inerrupt TIM4_Handler.Init.ClockDivision=TIM_CLOCKDIVISION_DIV1; TIM4_Handler.Init.RepetitionCounter=0; HAL_TIM_Base_Init(&TIM4_Handler);When I run code like above, UEV interrupt occure in 1 sec. This is normal
But when I change clock division suc as TIM_CLOCKDIVISION_DIV4, this period is not affected. There is an UEV interrupt in 1 sec.
What is the problem? (Note that my APB1/2 clock is 16MHZ)
