Skip to main content
liviana
Associate II
April 30, 2014
Question

Read PWM input without TIM

  • April 30, 2014
  • 1 reply
  • 610 views
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. 
    This topic has been closed for replies.

    1 reply

    Tesla DeLorean
    Guru
    April 30, 2014
    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 VenmoUp vote any posts that you find helpful, it shows what's working..