AnsweredAssumed Answered

Setting Up Input Capture To Measure Period and Duty Cycle of PWM

Question asked by gismofx on Mar 21, 2016
Latest reply on Mar 21, 2016 by gismofx
I'm using an STM32F405/STM32F4xx family Mcu and attempting to setup Input Capture to measure Period and Duty Cycle of a PWM. After some trial and error after following section 13.3.6 PWM Input Mode I was able to get some values in CCR1 and CCR2. First, the period seems to be CCR1+CCR2 where as the example says CCR1 is the period. Also, I seem to get incorrect results about 20% of the time, which makes me question the setup.

Specifically, I am using Timer 9, Input Channel 2 via PA3 to accomplish this.

Can someone please explain, step-by-step, with a little more detail how to setup the registers to get this to work correctly. Including any precursory register setup/clearing that may affect the result that may be a little outside of the Timer 9 registers. Bonus, if you can explain what's happening when the registers are set that would be helpful! Thanks!