Question
STM32L476 ClockDivision
Posted on August 25, 2016 at 09:59
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,