AnsweredAssumed Answered

STM32L476 ClockDivision

Question asked by CONSTANT.Jonathan on Aug 25, 2016
Latest reply on Aug 25, 2016 by Clive One
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 set TIM_CLOCKDIVISION_DIV4 but it's not working. I am using Prescaler, 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) = 500

timer.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,

Outcomes