cancel
Showing results for 
Search instead for 
Did you mean: 

Read PWM input without TIM

liviana
Associate II
Posted on April 30, 2014 at 04:29

Excuse me, I want to ask, can I know duty cycle of PWM without using TIM? I thought if I can read the time of PIN either in high or low logic and then divided by period. So I can measure the duty cycle. Assumption : I know the frequency of PWM input, so I can determine the period at first. 

Thank you very much. 
1 REPLY 1
Posted on April 30, 2014 at 05:09

Well you can certainly time stamp the pin transitions against some other free running time base, and from those compute period/duty. You could use the EXTI interrupts. The desire to do this in software will limit the maximal frequency.

You could use some other 32-bit TIM, or the core cycle counter DWT_CYCCNT
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..