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.

TMS320F28069: F28069 - CBC

Part Number: TMS320F28069

Hi

I tried to use CBC module of F28069. I programmed PWM4A/B and PWM5A/B to be switch off on compactor COMP2A event.  For application needs, PWM4 and PWM5 are phased of 45°. Comparator occurs one time when PWM4 is positive and one time when PWM5 is positive. Here under abstract of the configuration code.

I use DacDrvCnf.c to set comparator.  Comparator2 must switch off both PWMs at the same time.

DacDrvCnf(2, Voltage, 0, 0, 0);

PWM init

    //*****************************************************
    // INIT FOR PWM4
    //*****************************************************
    // Define an event (DCAEVT2) based on Comparator 1 Output
    (*ePWM[n]).DCTRIPSEL.bit.DCAHCOMPSEL     = DC_COMP2OUT;     // DCAH = Comparator 2 output
    (*ePWM[n]).TZDCSEL.bit.DCAEVT2              = TZ_DCAH_HI;   
                                                                             // as Comparator output goes high)    
    (*ePWM[n]).DCACTL.bit.EVT2SRCSEL         = DC_EVT_FLT; //DC_EVT2;
    (*ePWM[n]).DCACTL.bit.EVT2FRCSYNCSEL = DC_EVT_ASYNC; //
    // Enable DCAEVT2 as CBC source
    (*ePWM[n]).TZSEL.bit.DCAEVT2             = 1; //CBC

    // What do we want the DCAEVT1 and DCBEVT1 events to do?
    (*ePWM[n]).TZCTL.bit.TZA     = TZ_FORCE_LO;     // EPWMxA will go low
    (*ePWM[n]).TZCTL.bit.TZB     = TZ_FORCE_LO;     // EPWMxB will go low

    (*ePWM[n]).TZEINT.bit.DCAEVT2 = 1; //Enable IT

    //===========================================================================
    // Event Filtering Configuration
    (*ePWM[n]).DCFCTL.bit.SRCSEL         = DC_SRC_DCAEVT2;
    (*ePWM[n]).DCFCTL.bit.BLANKE         = DC_BLANK_ENABLE;
    (*ePWM[n]).DCFCTL.bit.PULSESEL         = DC_PULSESEL_ZERO;

    (*ePWM[n]).DCFOFFSET                 = 2;         // Blanking Window Offset = CMPA(n+1)
    (*ePWM[n]).DCFWINDOW                 = 10;         // Blanking window length - initial value
    //===========================================================================



    //*****************************************************
    // INIT FOR PWM5
    //*****************************************************
    // Define an event (DCAEVT2) based on Comparator 1 Output
    (*ePWM[n+1]).DCTRIPSEL.bit.DCAHCOMPSEL     = DC_COMP2OUT;     // DCAH = Comparator 2 output
    (*ePWM[n+1]).TZDCSEL.bit.DCAEVT2       = TZ_DCAH_HI;     // DCAEVT1 = DCAH high(will become active
                                                                         // as Comparator output goes high)       
    (*ePWM[n+1]).DCACTL.bit.EVT2SRCSEL            = DC_EVT_FLT; //DC_EVT2;      
    (*ePWM[n+1]).DCACTL.bit.EVT2FRCSYNCSEL  = DC_EVT_ASYNC; // Take async path
    // Enable DCAEVT2 as a CBC
    (*ePWM[n+1]).TZSEL.bit.DCAEVT2             = 1;

    // What do we want the DCAEVT1 and DCBEVT1 events to do?
    (*ePWM[n+1]).TZCTL.bit.TZA     = TZ_FORCE_LO;     // EPWMxA will go low
    (*ePWM[n+1]).TZCTL.bit.TZB     = TZ_FORCE_LO;     // TZ_FORCE_LO;     // EPWMxB will go low

    (*ePWM[n+1]).TZEINT.bit.DCAEVT2 = 1; // enable IT

    //===========================================================================
    // Event Filtering Configuration
    (*ePWM[n+1]).DCFCTL.bit.SRCSEL             = DC_SRC_DCAEVT2;
    (*ePWM[n+1]).DCFCTL.bit.BLANKE             = DC_BLANK_ENABLE;
    (*ePWM[n+1]).DCFCTL.bit.PULSESEL         = DC_PULSESEL_ZERO;

    (*ePWM[n+1]).DCFOFFSET                     = 2;         // Blanking Window Offset = CMPA(n+1)
    (*ePWM[n+1]).DCFWINDOW                     = 10;         // Blanking window length - initial value
    //===========================================================================
    EDIS;

and in other part

__interrupt void epwm4_tz1_int_isr(void){

    CountEvent++;

    EALLOW;
    EPwm4Regs.TZCLR.all         = 0xFF; // Clear Flags
    EDIS;

    // Acknowledge this interrupt to receive more interrupts from group 2
    PieCtrlRegs.PIEACK.bit.ACK4 = 1;

}

Same code for PWM5.

=> Interrupts work well and properly.

=> CBC flag, DCAEVT2 flag and INT flag appeared for PWM4 and 5

I cleared IT and CBC flags BUT for me CBC should reactivate automatically PWMs without need of IT or clearing flag, rights ?

What I would like to do is switching off PWM4 A/B and PWM5 A/B on COMP2A event but I would like that PWMs restart to continue their cyle on the half period or on period event (if COMP event disappeared obviously) WITHOUT INTs or clearing flags.

How to perform it ? I hope I was clear...

Thanks for your help

Ol

 

  • Hello,

    What I would like to do is switching off PWM4 A/B and PWM5 A/B on COMP2A event but I would like that PWMs restart to continue their cyle on the half period or on period event (if COMP event disappeared obviously) WITHOUT INTs or clearing flags.

    The current implementation you have is correct. The only way to clear the CBC flag is to write to the TZCLR register. This is the only way to implement the PWMs restarting at the ZRO, PERIOD, or ZERO or PERIOD event (TZCLR[CBCPULSE]). 

    Best Regards,

    Marlyn

  • Hi,

    Thank you for your answer. In the F28069 data sheet SPRUH18G, i found this

    So, it should be automatically cleared when upcount PWM reach zero without the need of interrupt and clear bit that right ? but how ? PWMs stay at level trip setteled (TZLO).

    Best regards,

    Ol

  • Hi Ol,

    PWMs stay at level trip setteled (TZLO).

    Have you confirmed that the trip is no longer present?

    So, it should be automatically cleared when upcount PWM reach zero without the need of interrupt and clear bit that right ?

    Ol, I'll need to test this on hardware and get back to you with a definite answer.

    Best Regards,

    Marlyn

  • Hi Marlyn,

    Yesterday, I did lot of tests. It is clear that PWMxAs work correctly and restart when the counter reaches the period or zero in count up mode.
    However PWMxB are not affected. PWMs A and B are set to complementary mode in AQCTLA.
    The PWMsxBs are constantly at zero, without change, whereas if I deactivate the CBC then they work correctly.
    So I also set the CBC for the PWMxBs using DCBEVT2 exactly like DCAEVT2 but nothing helped I have no change of state of the PWMxBs.
    The typical case is that with the PWMx1A shifted by 180° for example (to see the effect on). In this case, I should therefore have for 1/2 period the PWM4A affected by the trip as well as the complementary PWM PWM5B and vice versa.

    In fact PWM4B must be in phase with PWM5A and PWM5B must be in phase with PWM4A in this way bridge works.
    PWM4A and PWM5A can be phased.

    If a CBC event occurs, it must therefore cut PWM4A and PWM5B at the (without changing PWM4B and PWM5A staying at zero) same time and reciprocally PWM5A and PWM4B must be cut simultaneously in the event of a CBC trip (without changing PWM5B and PWM4A staying at zero). In both case, PWM should restart at the period or half period.
    How to cut 4A-5B on a half period on a CBC event and 5A-4B on the other 1/2 period on the second CBC event?
    Regards,
    OL

  • OL,

    Marlyn is out of the office and will be back on Monday, at which time she will respond to your questions. Thank you for your patience.

  • Hi OL

    However PWMxB are not affected. PWMs A and B are set to complementary mode in AQCTLA.
    The PWMsxBs are constantly at zero, without change, whereas if I deactivate the CBC then they work correctly.

    Can I please see the rest of your initialization code for how you setup the time base, counter-compare, and action qualifier submodules?

    In fact PWM4B must be in phase with PWM5A and PWM5B must be in phase with PWM4A in this way bridge works.
    PWM4A and PWM5A can be phased.

    You cannot apply a specific phase to EPWM4A and another to EPWM4B through the TBPHS register, this is only per EPWM module. However, the phases can also be created through the counter compare values (if you offset them). 

    If a CBC event occurs, it must therefore cut PWM4A and PWM5B at the (without changing PWM4B and PWM5A staying at zero) same time and reciprocally PWM5A and PWM4B must be cut simultaneously in the event of a CBC trip (without changing PWM5B and PWM4A staying at zero)

    Please take a look at the diagram below. As soon as there is a CBC trip, this gets routed to both A and B outputs of the same EPWM module. You can control the outputs of both through the TZA/TZB bits of the TBCTL register, but you cannot specify where in the epwm cycle you would like for the trip action to start. All outputs will take on the actions defined by the TBCTL register upon the trip condition.

    How to cut 4A-5B on a half period on a CBC event and 5A-4B on the other 1/2 period on the second CBC event?

    Please refer to my previous reply in this same message.

    Best Regards,

    Marlyn