CubeMX timer configuration question (screenshot attached)

656 views Asked by At

I am trying to understand how timer on the internal clock works. I've attached my CubeMX config below.

For now, I have set the main clock to 480 MHz which is the maximum for this STM32H743ZI chip. I am using TIM 2 so I am looking at APB1.

there from the clock tree I see that it is currently so to 240 MHz for Timer Clocks, and 120 MHz for Peripheral Clocks.

  1. My first question is that why is it using the 120MHz where it clearly says "240 MHz" for "timer clocks on APB1"? I have verified the frequency with an oscilloscope.

It is a long shot but according to what I read is that the maximum timer clock for this chip is 200 MHz. So 240 being greater than 200, perhaps the chip is automatically applying a /2 divider? I would think the clock configuration tree would say something, instead of allowing the "240 MHz" to be applied?

  1. My second question: For the sake argument, let's say that the maximum timer clock really is 200 MHz, how do I go about setting 200 MHz as clock frequency for APB1? I am sure there is no way to achieve 200 MHz without compromising on the max MCU clock and bring it down from 480 to 400 MHz perhaps?

  2. Can I trust the automatic prescaler/multiplier adjustments that CubeMX is doing whenever I change something?

enter image description here

1

There are 1 answers

5
0___________ On

How did you checked it with the scope? It is inside the chip?

  1. The timer clock is 240MHz, other peripheral clocks connected to the APB1 are 120MHz.

according to what I read is that the maximum timer clock for this chip is 200 MHz.

Where did you read that? official documentation says something different

enter image description here

  1. I think this question does not make too much sense

  2. You see the values, you can check them manually if you wish, but in this case computers are usually are better than humans. Personally I did not have any problems with Cube. BTW I use it only for the clocks (I am too lazy to calculate all the prescallers by hand), but I program it bare register way.