2016-08-25 12:59 AM
Hello,
I am using the board Nucleo-L476RG, the system core clock is running at 80 Mhz. I don't understand what is the purpose of ClockDivision. I thought that I can divide the frequency by 4 if I setTIM_CLOCKDIVISION_DIV4 but it's not working. I am usingPrescaler, but it's not enough because I need to count around 60sec using 16bit timer. Here is my code to have a 500 Hz frequency 80Mhz/ ((Prescaler+1)*ClockDivision
) = 500timer.Instance = TIM6;
timer.Init.Period = 0xffff;
timer.Init.CounterMode = TIM_COUNTERMODE_UP;
timer.Init.Prescaler = 40000 - 1;
timer.Init.ClockDivision = TIM_CLOCKDIVISION_DIV4; // has no effect
timer.Init.RepetitionCounter = 0;
HAL_TIM_Base_Init(&timer);
Thanks for your help,
2016-08-25 01:36 AM
Hi constant.jonathan,
The Timer clock division CKD does not relate to the time-Base update. The prescaler and period does. As mentioned in the corresponding register in reference manual, it is related ti the dead time configuration.''Bits 9:8
CKD[1:0]
: Clock division
This bit-field indicates the division ratio between the timer clock (CK_INT) frequency and the
dead-time and sampling clock (t
DTS
)used by the dead-time generators and the digital filters
(TIx)'
-Hannibal-
2016-08-25 10:45 AM
Yes, unrelated to what you think it is does.
Use a 32-bit counter, use one that has a Repetition Counter setting the timebase to 1sec and repeat 60 times, the Update Interrupt will fire once a minute.Use the RTC?Use the 1ms/1KHz timer to count off time?