2 Replies Latest reply on Jan 21, 2015 1:46 PM by MichaelF_56 Branched to a new discussion.

    Continuous PWM output

      I want to continuously drive a PWM output (until I choose to turn it off.)

      From the part datasheet, the PWM hardware seems capable of continuous output. I just need a way to set it.


      pwm_start() seems like the right function to call. But, it only drives the buzzer for a second or so.

      (It would be great if I could find the source code for pwm_start(), but that's a different topic.)


      I've tried disabling sleep (using advice from the forum,) but to no avail. The buzzer only lasts for a second.


      Any advice is appreciated.

      My code is a modified hello_sensor. It just enables the buzzer GPIO, initializes ACLK, and starts PWM with something like this:


           pwm_start(PWM2, PMU_CLK, 0x2FF, 0x200);

           gpio_configurePin((GPIO_PIN_BUZZER) / 16, (GPIO_PIN_BUZZER) % 16, PWM2_OUTPUT_ENABLE_P28, 0);


      (I could probably set a timer/interrupt to continuously restart the PWM. But, this seems unnecessarily complex. I'd prefer to just set the PWM hardware to go continuously.)