I'm learning by myself how to handle timers in CubeMx. I've got some simple questions.
First question:
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 mode to measure the period of an input signal. So, in the interrupt callback I can say:
period = HAL_TIM_ReadCapturedValue(&htim1, TIM_CHANNEL_2);
Does this say the period in milliseconds? Or is this the right way to ask for the period?
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?
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?