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.

CCS/TMS320F28069: Output low for both EPWMxA and EPWMxB at the same time if EPWMxB is Inverted of EPWMxA

Part Number: TMS320F28069

Tool/software: Code Composer Studio

I have configured my EPwm1 A and B as inverted. Now I want to have both (A and B) low for some time. With Trip Zone I only manage to have: A and B high, A high and B low, A low and B high. Both low is not possible.

Why?

Is there a better solution to my problem then to change B to normal and afterwards back to inverted?

My Configuration:

EPwm1Regs.TBCTL.bit.PRDLD = TB_SHADOW;           
EPwm1Regs.TBPRD = 37;                            
EPwm1Regs.CMPA.half.CMPA = 19;                   
EPwm1Regs.CMPA.half.CMPAHR = (1 << 8);            
EPwm1Regs.TBPHS.all = 0;                         
EPwm1Regs.TBCTR = 0;                              
EPwm1Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;        
EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_DISABLE;    //disable EPWMxSYNCO - Signal
EPwm1Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;           //TBCLK = SYSCLKOUT / (HSPCLKDIV x CLKDIV) (= 90MHz)
EPwm1Regs.TBCTL.bit.CLKDIV = TB_DIV1;              //TBCLK = SYSCLKOUT / (HSPCLKDIV x CLKDIV) (= 90MHz)
EPwm1Regs.TBCTL.bit.FREE_SOFT = 11;                //Behaviour of ePWM Time Base Counter in Emulation Mode: Free running
EPwm1Regs.CMPCTL.bit.LOADAMODE = CC_CTR_PRD;       //Load on CTR: Time Base Counter equal to period (TBCTR = TBPRD)
EPwm1Regs.CMPCTL.bit.SHDWAMODE = CC_SHADOW;        //CMPA-Register writes go to the shadow register
EPwm1Regs.AQCTLA.bit.ZRO = AQ_SET;                 //Action for Output A when Counter Equals to Period: Set EPWMxA high
EPwm1Regs.AQCTLA.bit.CAU = AQ_CLEAR;               //Action for Output A when Counter Equals to CMPA and Counter is incrementing: force EPWMxA to low
EALLOW;
EPwm1Regs.HRCNFG.all = 0x0;                        //Reset the high Resolution Configuration Register
EPwm1Regs.HRCNFG.bit.EDGMODE = HR_BEP;             //Micro-edge Positioner (MEP) controls both edges (CMPAHR and TBPRDHR)
EPwm1Regs.HRCNFG.bit.CTLMODE = HR_CMP;             //CMPAHR or TBPRDHR Register controls the edge Position
EPwm1Regs.HRCNFG.bit.HRLOAD = HR_CTR_ZERO_PRD;     //Time Event for loading CMPAHR Shadow to Active Register: Counter = Zero or Counter = PRD
EPwm1Regs.HRCNFG.bit.SELOUTB = HR_INVERT_B;        //EPWMxB Output: is the inverted version of EPWMxA signal
EPwm1Regs.HRCNFG.bit.AUTOCONV = 1;                 //CMPAHR and TBPRDHR are automatically scaled by the HRMSTEP Register (SFO library function)
EPwm1Regs.HRPCTL.bit.HRPE = 1;                     //HRPWM Module can control high resolution of both Duty and Frequency
EPwm1Regs.HRPCTL.bit.TBPHSHRLOADE = 0;             //Disables Synchronization of high-resolution phase on a SYNCIN, TBCTL(SWFSYNC) or digital Compare Event

//Trip Zone configuration:

EPwm1Regs.TZCTL.bit.TZB = 0x2;
EPwm1Regs.TZCTL.bit.TZA = 0x2;

EDIS;

//Force both low:

EALLOW;

EPwm1Regs.TZFRC.bit.OST = 1;

EDIS;

//Clear force to low:

EALLOW;

EPwm1Regs.TZCLR.bit.OST = 1;

EDIS;

The only solution I found was:

//Force both low:

EALLOW;

EPwm1Regs.HRCNFG.bit.SELOUTB = HR_NORM_B;

EPwm1Regs.TZFRC.bit.OST = 1;

EDIS;

//Clear force to low:

EALLOW;

EPwm1Regs.HRCNFG.bit.SELOUTB = HR_INVERT_B;

EPwm1Regs.TZCLR.bit.OST = 1;

EDIS;

  • User3879722,

    I think you should be able to do this with just the trip-zone submodule. 

    1. Make sure that your code doesn't clear the trip immediately after forcing it.
    2. You will need to configure the trip zone FULLY.
      1. Configure all DCxEVTy to "do nothing" unless they are being used
      2. Configure all TZx sources to "do nothing" unless they are being used
      3. Configure the CBC trip to "do nothing" unless its being used.
    3. Ensure the Digital Compare submodule is fully configured
    1. Ocassionally a TZx signal will be configured to a PWM causing all kinds of crazy trip signals.

    Regards,
    Cody 

    CTR=PRD

  • I am going to close this thread due to inactivity.

    Cody
  • Dear Cody
    I tried it again with EPwm2:
    EALLOW;
    EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // A force to low
    EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO; // B force to low
    EPwm2Regs.TZFRC.bit.OST = 1; // set ONESHOT Flag
    EDIS;
    I set a breakpoint at EDIS. The EPwm2 A and B stops, but A is low and B is high.
    I think you can not force B to low because of:
    EPwm2Regs.HRCNFG.bit.SELOUTB = HR_INVERT_B; The trip zone can not override this configuration!

    If you try it this way:
    EALLOW;
    EPwm2Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // A force to low
    EPwm2Regs.TZCTL.bit.TZB = TZ_FORCE_LO; // B force to low
    EPwm2Regs.HRCNFG.bit.SELOUTB = HR_NORM_B;
    EPwm2Regs.TZFRC.bit.OST = 1; // set ONESHOT Flag
    EDIS;
    A and B is low at EDIS.
    So the question for me is: How can I have inverted signals (A and B) and then stop A and B so that both are low? Is it only possible if I change EPwm2Regs.HRCNFG.bit.SELOUTB to HR_NORM_B?

    Best regards!

    Adrian
  • Adrian,
    I am looking into this and will post back soon.

    Regards,
    Cody
  • Adrian,

    Is it possible, in your application, to use Dead band module to achieve the needed inversion of the outputs A and B?
    Please refer to "Figure 3-31. Configuration Options for the Dead-Band Submodule" and see if the switches can be configured (with no rising and falling edge delay values) to achieve simple inversion of the outputs.
    If you can use this configuration, the trip configuration should give you the in intended effect. i.e. both outputs can be forced low.

    -Bharathi.
  • Dear Bharathi

    If I use the dead band module then I loose the high resolution of the inverted channel B which I need.

    Adrian

  • Adrian,

    If you've to use EPwm2Regs.HRCNFG.bit.SELOUTB for inversion - trip behavior (in case of force Low/High) will be same as you are observing.
    So, i do not see a work around with EPwm2Regs.HRCNFG.bit.SELOUTB option used.


    -Bharathi.