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).