2 Replies Latest reply on Oct 20, 2014 7:46 AM by userc_10288

    Can't get 100% duty cycle from PWM

      I'm having trouble getting 100% duty cycle from the PWM. 0-99% works great but I always get a small negative pulse at 100%. I'm using the LHL_CLK to get a 1 kHz signal. I'm trying to get 100% by calling:

       

      pwm_transitionToSubstituteValues(PWM1, 895, 895);

       

      Is there anyway to get 100%?

        • 1. Re: Can't get 100% duty cycle from PWM
          ArvindS_76

          You cannot have init value == toggle value. The HW uses a counter that controls the output level and it cannot be both high and low at the same time. If you want the output to be always on or always off, just drive the output using gpio_configurePin().

          1 of 1 people found this helpful
          • 2. Re: Can't get 100% duty cycle from PWM

            So I need to special case 100%? Seems rather clunky I'm not sure on the order of operations here. I've tried disabling the PWM at 100% and calling gpio_configurePin but this is unrealiable; the pin goes low sometimes even though I set it high. Then when transitioning back below 100%, the duty cycle sometimes gets inverted. Do I need to reset the PWM perhaps?