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.

TMS320F280049C: HR dead time on OutB

Part Number: TMS320F280049C


Hi Team,

I have a question regarding the high-resolution dead-band functionality on ePWM output B, hopefully you can help me out here.

I have configured the dead-band module to active high complementary mode: both FED and RED use EPWM1A for input, FED output is inverted. FED delay is 10, resulting in a 50-ns dead-band (half cycle mode). In my code the duty cycle is set to 50%, and I am sweeping CMPAHR from 0 to 255, as seen on the scope image below (OutA on Ch1, yellow). Meanwhile, OutB (Ch2, blue) rising edge is not moving. Is this the expected behavior, shouldn't OutB rising edge move and maintain 50-ns dead-band all the time?

Below is my initialization code for the ePWM, am I missing something here? I am able to change the dead-band while debugging, both coarse and fine part, but the dead-band is always with regards to the coarse part of CMPA, ignoring the CMPAHR part.

void initEPWM() {
    SysCtl_disablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); // Disable sync and clock to TB

    // Configure frequency, duty, phase, outputs
    EPWM_setTimeBasePeriod(EPWM1_BASE, EPWM1_TIMER_TBPRD); // Set timer period
    EPWM_setTimeBaseCounter(EPWM1_BASE, 0U); // Set timer initial value
    EPWM_setPhaseShift(EPWM1_BASE, 0U); // No phase shift
    EPWM_setTimeBaseCounterMode(EPWM1_BASE, EPWM_COUNTER_MODE_UP); // Set UP counter mode
    EPWM_disablePhaseShiftLoad(EPWM1_BASE); // No phase shift load
    EPWM_setClockPrescaler(EPWM1_BASE,EPWM_CLOCK_DIVIDER_1,EPWM_HSCLOCK_DIVIDER_1); // Set timer clock prescaler to 1:1
    EPWM_setCounterCompareValue(EPWM1_BASE,EPWM_COUNTER_COMPARE_A,EPWM1_CMPA); // Set CMPA
    HRPWM_setHiResCounterCompareValueOnly(EPWM1_BASE,HRPWM_COUNTER_COMPARE_A,0); // Set CMPA.HR
    EPWM_setCounterCompareShadowLoadMode(EPWM1_BASE,EPWM_COUNTER_COMPARE_A,EPWM_COMP_LOAD_ON_CNTR_ZERO); // Enable double buffering for CMPA
    EPWM_setActionQualifierAction(EPWM1_BASE,EPWM_AQ_OUTPUT_A,EPWM_AQ_OUTPUT_HIGH,EPWM_AQ_OUTPUT_ON_TIMEBASE_ZERO); // PWMA output goes 1 on TB=0
    EPWM_setActionQualifierAction(EPWM1_BASE,EPWM_AQ_OUTPUT_A,EPWM_AQ_OUTPUT_LOW,EPWM_AQ_OUTPUT_ON_TIMEBASE_UP_CMPA); // PWMA output goes 0 on TB=CMPA

    // Configure dead time
    EPWM_setDeadBandCounterClock(EPWM1_BASE, EPWM_DB_COUNTER_CLOCK_HALF_CYCLE); // Half clock cycle used as unit for dead time
    EPWM_setDeadBandControlShadowLoadMode(EPWM1_BASE, EPWM_DB_LOAD_ON_CNTR_ZERO); // Enable double buffering 
    EPWM_setDeadBandDelayMode(EPWM1_BASE, EPWM_DB_RED, true); // Enable rising edge delay
    EPWM_setDeadBandDelayMode(EPWM1_BASE, EPWM_DB_FED, true); // Enable falling edge delay
    EPWM_setFallingEdgeDeadBandDelayInput(EPWM1_BASE, EPWM_DB_INPUT_EPWMA); // EPWMA used for rising edge delay
    EPWM_setRisingEdgeDeadBandDelayInput(EPWM1_BASE, EPWM_DB_INPUT_EPWMA); // EPWMA used for falling edge delay 
    EPWM_setDeadBandDelayPolarity(EPWM1_BASE, EPWM_DB_RED, EPWM_DB_POLARITY_ACTIVE_HIGH); // RED output (OutA path) is not inverted
    EPWM_setDeadBandDelayPolarity(EPWM1_BASE, EPWM_DB_FED, EPWM_DB_POLARITY_ACTIVE_LOW); // FED output (OutB path) is inverted
    EPWM_setDeadBandOutputSwapMode(EPWM1_BASE, EPWM_DB_OUTPUT_A, false); // No swap on OutA output
    EPWM_setDeadBandOutputSwapMode(EPWM1_BASE, EPWM_DB_OUTPUT_B, false); // No swap on OutB output
    EPWM_setFallingEdgeDelayCount(EPWM1_BASE, EPWM1_DTF); // Set rising edge delay
    EPWM_setRisingEdgeDelayCount(EPWM1_BASE, EPWM1_DTR); // Set falling edge delay

    // Configure HR
    HRPWM_setMEPEdgeSelect(EPWM1_BASE, HRPWM_CHANNEL_A, HRPWM_MEP_CTRL_FALLING_EDGE); // Set MEP to control falling edge on EPWMA
    HRPWM_setMEPControlMode(EPWM1_BASE, HRPWM_CHANNEL_A, HRPWM_MEP_DUTY_PERIOD_CTRL); // Set MEP to be controlled by CMPAHR
    HRPWM_setCounterCompareShadowLoadEvent(EPWM1_BASE, HRPWM_CHANNEL_A, HRPWM_LOAD_ON_CNTR_ZERO); // Enable double buffering
    HRPWM_setDeadbandMEPEdgeSelect(EPWM1_BASE, HRPWM_DB_MEP_CTRL_FED); // Set high resolution dead-band MEP control

    SysCtl_enablePeripheral(SYSCTL_PERIPH_CLK_TBCLKSYNC); // Enable sync and clock to TB
}

Thanks and regards,

Milos

  • Hi Milos,

    I believe you are using up-count mode for the timer. There is a limitation on the edge placement in the up-count mode.
    Could you try up-down count mode and share your observation? With up-count in HR mode the first edge has to be placed at counter zero event and with deadtime it moves out of that first 3-cycle window. Please share your observation in the up-down count mode.

  • Hi Subrahmanya,

    Yes I am using up-count mode, and would like to stay there as this is for a buck converter. Yes, there is a limitation on the edge placement, the duty cycle should not be shorter than 3 clock cycles, and the same is valid for dead-band length. However, here I have the duty cycle of 50%, and dead-band of 10 clock cycles, so I should be safe. The dead-band is working only for the coarse part, so my question is if there is a hardware limitation when using HR dead-band with PWMA being the source for both OutA and OutB? If so, I will have to use PWMB to generate the complementary signal, or implement it externally.

    Regards,

    Milos

  • Hi,

    Thanks for the details. Limitation is w.r.t to edge placement as well in addition to the minimum pulse width.
    In up-count mode one of the edges has to occur at the beginning of the period, at counter zero, and other edge at 50% duty for your case.
    This is the right configuration, but with deadband RED the rising edge at counter zero moves by 10 cycles as per your deadband configuration.
    Note that this limitation comes in effect in HR mode of operation only. That's why you are seeing that the coarse part is working as expected but not the fine part.
    So, due to the edge placement limitation, in the up-count mode, it's not amenable to deadband operation in HR mode.

    Milos said:
    so my question is if there is a hardware limitation when using HR dead-band with PWMA being the source for both OutA and OutB? If so, I will have to use PWMB to generate the complementary signal, or implement it externally.


    You could chose PWMA or B as source, but limitation stated above makes it impractical to use deadband in HR mode, in up-count mode. Same limitation doesn't apply in the up-down count mode. Hence the suggestion to use up-down count mode.

  • Hi Subrahmanya,

    Thanks, I will give it a try using the up/down mode. 

    But just want to make it clearer. The above image shows the edges around 50% duty, channel A falling edge and channel B (inverted FED from channel A) rising edge after a defined dead time. This is where both edges should move in HR when changing the duty cycle, but B output changes only when the coarse part of channel A changes. I was just expecting the dead band to stay constant here, far away from the beginning and the end of the period. I can still set the dead band precisely, with HR part as well. but this HR dead band on B output is w.r.t. the coarse part of CMPA only, it does not take into account HR part of CMPA. I am not concerned with the dead band at the beginning of the period because edges there will never move.

    Best regards,

    Milos

  • Hi Milos,

    I understand what you are trying to do now - thanks for the clarification.
    But, inherently there is a limitation w.r.t. using deadband with Up-Count mode in the HR mode of operation.
    I think, though you are observing a different edge, i believe it's a manifestation of the same issue - i stated above.
    It would be great if you can check and let me know the observation on the up-down count mode.