cancel
Showing results for 
Search instead for 
Did you mean: 

PWM Input capture and PWM output with same timer

eancelin
Associate II
Posted on March 27, 2015 at 16:06

Hi,

I'm working with an STM32F103RB.

I try to do a PWM input capture (frequency and duty) and also PWM     output with the same TIMER.

It seems there is a problem.

My pwm output restarts when a rising edge occurs on thepwminput.

For the PWM Input capture, i'm using TIM3 channel 1 (and channel2 for duty cycle) and for PWMoutput, i'm using TIM3 channel 3.

If I activate only the PWM Input, it works.

And also, if I activate only the PWMOutput, it works.

Is there a limitation or maybe I forget to disable a reset ?

Thanks

#stm32f103 #pwm #timer
1 REPLY 1
Posted on March 27, 2015 at 16:12

PWM Input resets the timer, that's how it works. The TIM only has a single counting element.

I don't see using the same timer to do measurement and PWM output, the periodicity of the timer is going to be rather limiting. If I really had to do this for myself, I'd using Input Capture, with a maximal period, using two channels to time stamp opposite edges, and I'd use Toggle Mode to control the output signal.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..