Hello everyone,
I am working on a design where I need to drive a piezo buzzer (@2.7kHz, 50%) at some regular intervals for a certain duration. The PWM seems to work fine whenever I start it, although it retains its previous state whenever I turn it off. I want the default state to be LOW, however there seems to be no way to configure it as such through any particular register (might have missed it).
A couple of possible solutions to this would either be to turn off the PWM by writing a LOW on the pin (unlikely this would work) OR make the duty 0 rather than turning off. Both of these methods don't seem to be a good way of doing it.
I am attaching the PWM scope waveform and the piece of code that I am using to achieve this. I would appreciate if someone could shed some more light on this.



Let me know if some more details are required regarding the macros that are being used for peripheral initialization.
Regards,
Ashwin619.