cancel
Showing results for 
Search instead for 
Did you mean: 

PWM

greg_t
Associate II
Posted on February 10, 2011 at 13:06

PWM

2 REPLIES 2
Posted on May 17, 2011 at 14:24

but what do I need to do - to set the output to a constant level ( Low or High ) ?

You could always drive it as a GPIO. I haven't tried the 0, n-1 or n settings, are you seeing a pulse?
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ColdWeather
Senior
Posted on May 17, 2011 at 14:24

clive1++:

At pwm value = 0 no pulses, the output line stays low (or high, if inverted). At value = max (0xFFFF) short pulses are present. The idea:

1. Init pwm GPIO output register to the state you need at pwm = max.

2. Switch pwm GPIO to AFIO to use it as pwm output.

3. As soon as the pwm value must be max, switch pwm output to GPIO - you got the output steady. Else (pwm value < max) switch pwm output back to AFIO and enjoy the pulses.

4. Do 3). in the match interrupt of the pwm channel (suggestion).