I want to enable the EPWM counter to count to period value and then not reset automatically. How to control the EPWM module output once and then stop? Thanks!
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I want to enable the EPWM counter to count to period value and then not reset automatically. How to control the EPWM module output once and then stop? Thanks!
Andrew,
the PWM module is designed to create a series of pulses with a period. The period, pulse width and phase relationship to other PWMs is intended to vary.
If you want to output a single pulse it may be better to use a GPIO and a CPU timer.
Nonetheless this can be done with the PWM module. You can configure an interrupt to trigger at TBCTR = TBPRD and handle the disabling of the PWM in the ISR.
Disabling the PWM can be done in a number of ways The Trip-zone submodule can force the PWM's output low while allowing the PWM's counter to continue to run. Similarly the Action Qualifier submodule can force the PWM's duty to 0% creating the same result, but the AQ will not work if the dead band is being used. Finally you have the option to stop the clock input to TBCTR which will "freeze" the PWM module where it is.
Similar example: https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/95623/stop-pwm
Please note that if you intend to restart the PWM you will need to make sure its in a known state or a partial pulse could be output: https://e2e.ti.com/support/microcontrollers/c2000/f/c2000-microcontrollers-forum/88022/epwm-start-stop-question/304532#304532
Regards,
Cody