Continuous PWM output

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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

0 Likes
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Please study the pwm_tones application that is included within the SDK.  This application uses a continuous output and was created to serve as a guide to getting started with the PWM functionality on the 2073XS devices.

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

Hello meme,

Have you checked the links like:

Re: How to get all 4 PWMs working at the same time on BCM20736S

Look at: IoT Hackathon Challenge

Lots of entries on the forum for PWM.

Thanks

JT

0 Likes
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Please study the pwm_tones application that is included within the SDK.  This application uses a continuous output and was created to serve as a guide to getting started with the PWM functionality on the 2073XS devices.

0 Likes