Skip to main content
greg_t
Associate III
February 10, 2011
Question

PWM

  • February 10, 2011
  • 2 replies
  • 441 views
Posted on February 10, 2011 at 13:06

PWM

    This topic has been closed for replies.

    2 replies

    ColdWeather
    Senior
    May 17, 2011
    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).

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