Hi Experts,
Could you please give me an example code for make DB as attached file?
Also, could you please teach me the each switch positions?
Thank you for your kind support.
Best regards,
Hitoshi
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.
Hi Experts,
Could you please give me an example code for make DB as attached file?
Also, could you please teach me the each switch positions?
Thank you for your kind support.
Best regards,
Hitoshi
From your image, you are NOT looking to do any complimentary mode. Each EPWM channel is independently running.
However you cant get BOTH RISING and FALLING EDGE DELAY on Channel A and Channel B at the same time when they are independant.
Does that make sense?
Driverlib actually make a very good source for description of the different switches.
Take a look at this example I wrote which showcases most of the different modes in the deadband module.
// // Initialize ePWM1 // initEPWMWithoutDB(myEPWM1_BASE); // // Initialize ePWM2 Active High // initEPWMWithoutDB(myEPWM2_BASE); setupEPWMActiveHigh(myEPWM2_BASE); // // Initialize ePWM3 Active Low // initEPWMWithoutDB(myEPWM3_BASE); setupEPWMActiveLow(myEPWM3_BASE); // // Initialize ePWM4 Active High Complimentary // initEPWMWithoutDB(myEPWM4_BASE); setupEPWMActiveHighComplementary(myEPWM4_BASE); // // Initialize ePWM5 Active Low Complimentary // initEPWMWithoutDB(myEPWM5_BASE); setupEPWMActiveLowComplementary(myEPWM5_BASE); // // Initialize ePWM6 Output Swap (switch A and B outputs) // initEPWMWithoutDB(myEPWM6_BASE); setupEPWMOutputSwap(myEPWM6_BASE);
void setupEPWMOutputSwap(uint32_t base) { // // Disable RED // EPWM_setDeadBandDelayMode(base, EPWM_DB_RED, false); // // Disable FED // EPWM_setDeadBandDelayMode(base, EPWM_DB_FED, false); // // Switch Output A with Output B // EPWM_setDeadBandOutputSwapMode(base, EPWM_DB_OUTPUT_A, true); EPWM_setDeadBandOutputSwapMode(base, EPWM_DB_OUTPUT_B, true); } void setupEPWMActiveHigh(uint32_t base) { // // Use EPWMA as the input for both RED and FED // EPWM_setRisingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); EPWM_setFallingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); // // Set the RED and FED values // EPWM_setFallingEdgeDelayCount(base, 200); EPWM_setRisingEdgeDelayCount(base, 400); // // Do not invert the delayed outputs (AH) // EPWM_setDeadBandDelayPolarity(base, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH); EPWM_setDeadBandDelayPolarity(base, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_HIGH); // // 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); } void setupEPWMActiveLowComplementary(uint32_t base) { // // Use EPWMA as the input for both RED and FED // EPWM_setRisingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); EPWM_setFallingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); // // Set the RED and FED values // EPWM_setFallingEdgeDelayCount(base, 200); EPWM_setRisingEdgeDelayCount(base, 400); // // Invert only the Rising Edge delayed output (ALC) // EPWM_setDeadBandDelayPolarity(base, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_LOW); EPWM_setDeadBandDelayPolarity(base, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_HIGH); // // 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); } void setupEPWMActiveHighComplementary(uint32_t base) { // // Use EPWMA as the input for both RED and FED // EPWM_setRisingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); EPWM_setFallingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); // // Set the RED and FED values // EPWM_setFallingEdgeDelayCount(base, 200); EPWM_setRisingEdgeDelayCount(base, 400); // // 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); } void setupEPWMActiveLow(uint32_t base) { // // Use EPWMA as the input for both RED and FED // EPWM_setRisingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); EPWM_setFallingEdgeDeadBandDelayInput(base, EPWM_DB_INPUT_EPWMA); // // Set the RED and FED values // EPWM_setFallingEdgeDelayCount(base, 200); EPWM_setRisingEdgeDelayCount(base, 400); // // INVERT the delayed outputs (AL) // EPWM_setDeadBandDelayPolarity(base, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_LOW); 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/4); EPWM_setCounterCompareValue(base, EPWM_COUNTER_COMPARE_B, 3*EPWM_TIMER_TBPRD/4); // // Set actions // EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); 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_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_A, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPA); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_HIGH, EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPB); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_NO_CHANGE, EPWM_AQ_OUTPUT_ON_TIMEBASE_PERIOD); EPWM_setActionQualifierAction(base, EPWM_AQ_OUTPUT_B, EPWM_AQ_OUTPUT_LOW, EPWM_AQ_OUTPUT_ON_TIMEBASE_DOWN_CMPB); }
Nima
Hi Nima,
I have shared the example code that you gave me with a customer.
Will work with them to create expected DB for the timing.
Let me close the inquiry.
If there is any further question, will open new thread on e2e.
Thank you so much for your kind support for the dead band control.
Best regards,
Hitoshi