set up pwm before clear