I have a common function that I use to set up Timer 5 (I'm using it for PWM output, if it matters):timerCounts = CLK_GetClockFreq() / pow(2, TIM5_PRESALER_xx) / pwmFrequency;TIM5_TimeBaseInit(TIM5_PRESCALER_xx, timerCounts);And that works really well...