Is there a basic way to generate the clock for the timers without the use of the clock generation tool?I used it several times and some times it seems to bug. Thank you for your attention.

The math isn't entire complicated, you're dividing a source clock by integer factors.

TIM_Prescaler = N - 1; // Divides the Bus/TIM clock down by N

TIM_Period = N - 1; // Divide that clock down by N, ie the *period* is N ticks.

So assume your TIMCLK is ticking at 168 MHz, the *external* clock

If TIM_Prescaler = 167; the timers *internal* clock will be 1 MHz

If TIM_Period = 999; the 1MHz is divided by a 1000, so it becomes 1KHz

Your update interrupt with fire every 1ms

Now if you want to play with the channels, say in a PWM mode you can play with the output pins.

If TIM_Pulse = 500; the channel will out a frequency of 1 KHz, with a 50/50 duty cycle. ie TIM_Pulse = N / 2

Now if you review the Clock Tree in the Reference Manual, your will observe the TIMCLK is typically 2X that of the APB bus clock it is attached too, except when the APB uses the DIV1 case, where there is no opportunity to "double" it, more specifically it takes a clock tap from one stage earlier in the divider chain.

TIM_Prescaler = N - 1; // Divides the Bus/TIM clock down by N

TIM_Period = N - 1; // Divide that clock down by N, ie the *period* is N ticks.

So assume your TIMCLK is ticking at 168 MHz, the *external* clock

If TIM_Prescaler = 167; the timers *internal* clock will be 1 MHz

If TIM_Period = 999; the 1MHz is divided by a 1000, so it becomes 1KHz

Your update interrupt with fire every 1ms

Now if you want to play with the channels, say in a PWM mode you can play with the output pins.

If TIM_Pulse = 500; the channel will out a frequency of 1 KHz, with a 50/50 duty cycle. ie TIM_Pulse = N / 2

Now if you review the Clock Tree in the Reference Manual, your will observe the TIMCLK is typically 2X that of the APB bus clock it is attached too, except when the APB uses the DIV1 case, where there is no opportunity to "double" it, more specifically it takes a clock tap from one stage earlier in the divider chain.