Skip to main content
Senior III
August 10, 2025
Solved

Clarifications on the Tim1 settings in Cube Mx

  • August 10, 2025
  • 3 replies
  • 448 views

I have the following settings in Cube Mx for TIM1

STuser2_0-1754838526230.png

The TIM1 is used for PWM generation, but the slave mode, trigger source, clock source are disabled then how Tim1 receives the clock for pwm generation.

For TIM4 it is clearly stated

STuser2_1-1754838739218.png

So i assume it will be taken from APB2 timer clock.

One final question

STuser2_2-1754838838981.png

It is mentioned TRGO2 as above but how do i know it is connected to what? Please help.

Best answer by waclawek.jan

Maybe you want to have a look at this tutorial.

I don't use Cube/CubeMX.

JW

3 replies

MHoll.2
Senior III
August 10, 2025

I don't understand Your question.

You have to select a clock source for every Timer you want to use.

TRGO2 (and TRGO) can be used as trigger for other peripherials (for example to start and ADC converter), You have to select the Triger source if used. Then You have to select it on the receving peripherial.

Please consult the Reference manuale for the MCU you are using.

 

STuser2Author
Senior III
August 10, 2025

It is an MCSDK 6.4.0 Cube MX project and I am trying to understand it.

waclawek.jan
Super User
August 10, 2025

What does the manual say, what is the meaning of "Clock source" there? 

JW

STuser2Author
Senior III
August 11, 2025

Ok, thank you for the inputs i started verifying it 

STuser2_0-1754887100385.png

As per the clock configuration the TIM1 is driven by external 8MHZ crystal and it is 170MHz clock. It is not mentioned as internal as it is external clock driven in the CubeMx settings.

STuser2_1-1754887247551.png

And for TIM4 it is driven by the internal clock as stated in the data sheet by 48MHz and also XOR of the Hall signals on TIM4Ch1, TIM4Ch2, TIM4Ch3.

waclawek.jan
waclawek.janBest answer
Super User
August 11, 2025

Maybe you want to have a look at this tutorial.

I don't use Cube/CubeMX.

JW