2022-05-04 01:44 AM
Hi everyone!
In my project, I use TIM2, TIM3, TIM4, TIM5, in each Timer module I choose PWM Input on CH1, and PWM Generation on CH3 function. My goal is to generate PWM pulse at channel 3 and feed back to PWM Input on CH1 to measure Duty cycle and frequency. For example, in the TIM2 module, I will connect the PWM Generation CH3 pin PB10 to the PWM Input on CH1 pin PA15. Other timer modules are similarly connected. But currently my program cannot measure Duty cycle and frequency. Is this method correct? Is it possible to use PWM Generation CHx and PWM Input on CHx function on the same Timer module?
I appreciate every answer.
This is my program
2022-05-04 06:42 AM
> Is it possible to use PWM Generation CHx and PWM Input on CHx function on the same Timer module?
Possibly, yes, but certainly not the typical method, and it has significant limitations. There's only one counter module for each timer. If you're using it for PWM generation, your update period is fixed. Using it for IC as well will be awkward. What's the point of measuring something you already know?
It is typically better to use a free-running timer to measure duty cycle/frequency. Subtract the tick times from successive triggers.
2022-05-05 12:03 AM
Hi TDK
Thanks for your reply
I don't understand about > If you're using it for PWM generation, your update period is fixed.
Can you explain it?
I have a question: I am using PWM Input and PWM Generation function on same Timer, PWM Generation function work and PWM Input function don't work. Why doesn't it happen in the opposite direction?