AnsweredAssumed Answered

Enabling and Disabling PWM

Question asked by roofie01 on Oct 5, 2017



On an STM32F4, I've configured and can generate a  PWM signal from 2 pins, offset by 180 degrees. This is using TIM3 and TIM4, on PB5 and PB6. What I want to be able to accomplish is this. I would like to be able to launch the output, then, switch off the PWM after "x" number of cycles, wait a precise number of cycles at the given frequency, and repeat the cycle. In truth, I am able to do it, but in some cases there is a variance in the bursts. For example, I want to drive 5 bursts of 15 cycles, separated by 7 cycles of no activity. However, one or 2 of the intervals are not even in time. Those could be out by 1 cycle, so instead of 7, it's 6. Ideally, there should be little variance from interval to interval.


Can someone provide some suggestion as to how to best do this? I think it's clear it will be within the interrupt...but I need a different approach.