2018-09-23 03:47 PM
Hello,
I'm still learning how to handle timers in CubeMx. I've got some simple questions.
I'm using TIM1 and TIM2 of the L432KC. In the clock tree, I see APB1/APB2 peripheral and timer clocks bus frequencies. I thought that when I set a prescaler, the APBx timer clock frequency is the one divided by the prescaler, but actually is the APBx peripheral clock frequency. What's the real difference?
Second question:
I've set timer 2 in PWM input to measure the period of an input signal. So,
.....
period = HAL_TIM_ReadCapturedValue(&htim1, TIM_CHANNEL_2);
....
Does this say the period in milliseconds, right?
Third question:
I read in an app note:
The TIMxCLK frequency is set to 72 MHz, the prescaler is 0x0 so the TIM2 counter clock frequency is 72 MHz. So the minimum frequency value to measure is 1100 Hz.
How do I calculate that minimun frequency?
Last question:
When setting the PWM input mode or input capture mode to measure an external signal, how do I choose the prescaler and counter period effectively in CubeMx according to my frequencies range?
Solved! Go to Solution.
2018-10-10 05:59 AM
Hi @XP.1acheco ,
Khouloud.
2018-10-22 01:51 PM
@Khouloud GARSI, perhaps you could clarify:
Which (APB1 timer clock or APB2 timer clock) is input to a specific timer?
Where is this documented?
Thanks!
PS: I know it does not matter in the above example, but it does matter for my clock tree...
2018-10-23 09:28 AM
Hi @Dave Nadler ,
In order to have this information, you may have a look on "RCC_APB1ENR" and "RCC_APB2ENR" registers in the reference manual.
You're always welcome!
PS: Please next time create a new thread 😊
Khouloud.