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.
Good morning.
I have a question about ePWM's Deadband.
PWM Counter Mode uses Up/Down.
If the deadband is longer than the time from Up to Down of CMPA, do OutA and OutB always maintain Low and High outputs?
I'm not very good at English, so I'm not sure if the question is correct.
So I drew a chart.
Is the chart I drew correct?
Thank you for checking.
Additional question.
TBCTR became Zero as it counted down.
However, when the FED Deadband value is too large and it is not finished yet, is the FED value initialized?
Or does it affect the next cycle (TBCTR=Count Up) until the end of the FED value?
Hi Bae Su-min,
Is the chart I drew correct?
Your diagram looks correct for the first two set of outputs when RED/FED=50 and RED/FED=150.
For the case when RED/FED is 200, EPWMA output is correct, the waveform will always be low. However, EPWMB output will have a 20% duty cycle. The value does get delayed onto the next cycle so it will require 150 from the current cycle (starting from the CMPA Down event) and then 50 from the next cycle. It will be high from 50-150 (until the CMPA UP event). Please let me know if a figure will help.
However, when the FED Deadband value is too large and it is not finished yet, is the FED value initialized?
Or does it affect the next cycle (TBCTR=Count Up) until the end of the FED value?
I answered this in the first part but it will affect the next cycle until the end of the FED value.
Best Regards,
Marlyn
Bae Su-min,
Here is some code you can use to test out different DB values with the setup you have. I only coded one output (EPWM2) but you can always just configure more outputs to call the setupEPWMActiveHighComplementary(base) function and maybe pass in the DB value as an input parameter.
// // Included Files // #include "driverlib.h" #include "device.h" #include "board.h" #define EPWM_TIMER_TBPRD 250UL // // Function Prototypes // void initEPWMWithoutDB(uint32_t base); void setupEPWMActiveHighComplementary(uint32_t base); void main(void) { // // Initialize device clock and peripherals // Device_init(); // // Disable pin locks and enable internal pull-ups. // Device_initGPIO(); // // Initialize PIE and clear PIE registers. Disables CPU interrupts. // Interrupt_initModule(); // // Initialize the PIE vector table with pointers to the shell Interrupt // Service Routines (ISR). // Interrupt_initVectorTable(); // // Configure ePWMs // Board_init(); // // Disable sync(Freeze clock to PWM as well). GTBCLKSYNC is applicable // only for multiple core devices. Uncomment the below statement if // applicable. // // SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_GTBCLKSYNC); SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); // // Initialize ePWM1 // initEPWMWithoutDB(myEPWM1_BASE); // // Initialize ePWM2 Active High // initEPWMWithoutDB(myEPWM2_BASE); setupEPWMActiveHighComplementary(myEPWM2_BASE); // // Enable sync and clock to PWM // SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); // // Enable Global Interrupt (INTM) and real time interrupt (DBGM) // EINT; ERTM; // // IDLE loop. Just sit and loop forever (optional): // for(;;) { NOP; } } void setupEPWMActiveHighComplementary(uint32_t base) { // // Use EPWMA as the input for RED // Use EPWMB as the input for FED // EPWM_setRisingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); EPWM_setFallingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMB); // // Set the RED and FED values // EPWM_setFallingEdgeDelayCount(base, 200); EPWM_setRisingEdgeDelayCount(base, 200); // // Invert only the Falling Edge delayed output (AHC) // EPWM_setDeadBandDelayPolarity(base, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH); EPWM_setDeadBandDelayPolarity(base, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW); // // Use the delayed signals instead of the original signals // EPWM_setDeadBandDelayMode(base, EPWM_DB_RED, true); EPWM_setDeadBandDelayMode(base, EPWM_DB_FED, true); // // DO NOT Switch Output A with Output B // EPWM_setDeadBandOutputSwapMode(base, EPWM_DB_OUTPUT_A, false); EPWM_setDeadBandOutputSwapMode(base, EPWM_DB_OUTPUT_B, false); } // // initEPWM - Configure ePWM1 // void initEPWMWithoutDB(uint32_t base) { // // Set-up TBCLK // EPWM_setTimeBasePeriod(base, EPWM_TIMER_TBPRD); EPWM_setPhaseShift(base, 0U); EPWM_setTimeBaseCounter(base, 0U); EPWM_setTimeBaseCounterMode(base, EPWM_COUNTER_MODE_UP_DOWN); EPWM_disablePhaseShiftLoad(base); // // Set ePWM clock pre-scaler // EPWM_setClockPrescaler(base, EPWM_CLOCK_DIVIDER_4, EPWM_HSCLOCK_DIVIDER_4); // // Set up shadowing // EPWM_setCounterCompareShadowLoadMode(base, EPWM_COUNTER_COMPARE_A, EPWM_COMP_LOAD_ON_CNTR_ZERO); // // Set-up compare // EPWM_setCounterCompareValue(base, EPWM_COUNTER_COMPARE_A, EPWM_TIMER_TBPRD-100); EPWM_setCounterCompareValue(base, EPWM_COUNTER_COMPARE_B, EPWM_TIMER_TBPRD-100); // // Set actions // EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); // // Set actions // EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); }
Best Regards,
Marlyn
Thanks for your detailed explanation, I understand everything.
Thank you very much for your help.