If you connect your PWM output to a scope or even an LED, does it behave correctly?