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.

c2000 digital compare and trip zone, bcc



I'm using the TMS320F32031.  I have setup ePWM1 with EPWM1A set at 0 and clear at CMPA.  I have setup EPWM1B to clear at 0 and clear at CMPA.  This works fine.  I have also setup the DC submodule, using the comparator, to feed into the trip zone submodule (CBC trip, DCAEVT2, DCBEVT2).  This also appears to be working fine.  My problem is physical output of EPWM1A and EPWM1B when probing with an oscilloscope.  I believe I can see the CBC trip, trying to occur, but it's not actually occurring.  EPWM1A, which is set to force low, appears to "float" low when the CBC trip occurs.  EPWM1B, which is set to force high, also appears to "float" when the CBC trip occurs, but the signal does not ever go high.  When no CBC trip occurs, the signals look perfect.  Both signals behave as commanded when the counter reaches 0 and CMPA.  Below is a copy of my setup.  I originally wanted to use the DB submodule of the peripheral to control the outputs, but I thought that was interfering with the CBC sub module.  I tried using a DCxEVT2 sync signal and async signal, filtered and unfiltered.  I also tried using DCBHCOMPSEL vs. DCBLCOMPSEL.  What am I doing incorrectly?  I have pasted portions of my code below.  Note n = pwm = 1, master = 1, invert = 0, period = 60, phase = 2.

// Time Base SubModule Registers

(*ePWM[n]).TBCTL.bit.PRDLD = TB_IMMEDIATE; // set Immediate load

(*ePWM[n]).TBPRD = period-1; // PWM frequency = 1 / period

(*ePWM[n]).TBPHS.half.TBPHS = 0;

//(*ePWM[n]).TBCTR = 0;

(*ePWM[n]).TBCTL.bit.CTRMODE = TB_COUNT_UP;

(*ePWM[n]).TBCTL.bit.HSPCLKDIV = TB_DIV1;

(*ePWM[n]).TBCTL.bit.CLKDIV = TB_DIV1;

if(mode == 1) {// config as a Master

(*ePWM[n]).TBCTL.bit.PHSEN = TB_DISABLE;

(*ePWM[n]).TBCTL.bit.SYNCOSEL = TB_CTR_ZERO; // sync "down-stream"

}

else if(mode == 0) { // config as a Slave (Note: Phase+2 value used to compensate for logic delay)

(*ePWM[n]).TBCTL.bit.PHSEN = TB_ENABLE;

(*ePWM[n]).TBCTL.bit.SYNCOSEL = TB_SYNC_IN;

if ((0 <= phase)&&(phase <= 2)) (*ePWM[n]).TBPHS.half.TBPHS = (2-phase);

else if (phase > 2) (*ePWM[n]).TBPHS.half.TBPHS = (period-phase+2);

}

// Counter Compare Submodule Registers

(*ePWM[n]).CMPA.half.CMPA = 0; // set duty 0% initially

(*ePWM[n]).CMPCTL.bit.SHDWAMODE = CC_SHADOW;

(*ePWM[n]).CMPCTL.bit.LOADAMODE = CC_CTR_PRD;

(*ePWM[n]).CMPB = 0; // set duty 0% initially

(*ePWM[n]).CMPCTL.bit.SHDWBMODE = CC_SHADOW;

(*ePWM[n]).CMPCTL.bit.LOADBMODE = CC_CTR_PRD;

// Action Qualifier SubModule Registers

if (invert) {

(*ePWM[n]).AQCTLA.bit.ZRO = AQ_CLEAR;

(*ePWM[n]).AQCTLA.bit.CAU = AQ_SET;

(*ePWM[n]).AQCTLB.bit.ZRO = AQ_SET;

(*ePWM[n]).AQCTLB.bit.CAU = AQ_CLEAR;

}

else {

(*ePWM[n]).AQCTLA.bit.ZRO = AQ_SET;

(*ePWM[n]).AQCTLA.bit.CAU = AQ_CLEAR;

(*ePWM[n]).AQCTLB.bit.ZRO = AQ_CLEAR;

(*ePWM[n]).AQCTLB.bit.CAU = AQ_SET;

}

ePWM[pwm]->TBCTL.bit.FREE_SOFT = 3;

//SETUP DIGITAL COMPARE FOR CURRENT

if (ps->parameters.bits.feedbackPin == 2) {

ePWM[pwm]->DCTRIPSEL.bit.DCAHCOMPSEL = 8; //COMP 1 OUT

ePWM[pwm]->DCTRIPSEL.bit.DCBHCOMPSEL = 8; //COMP 1 OUT

}

else if (ps->parameters.bits.feedbackPin == 4) {

ePWM[pwm]->DCTRIPSEL.bit.DCAHCOMPSEL = 9; //COMP 2 OUT

ePWM[pwm]->DCTRIPSEL.bit.DCBHCOMPSEL = 9; //COMP 2 OUT

}

ePWM[pwm]->DCACTL.bit.EVT2FRCSYNCSEL = 1; //async signal

ePWM[pwm]->DCACTL.bit.EVT2SRCSEL = 0; //filtered signal

ePWM[pwm]->DCBCTL.bit.EVT2FRCSYNCSEL = 1; //async signal

ePWM[pwm]->DCBCTL.bit.EVT2SRCSEL = 0; //filtered signal

ePWM[pwm]->DCFCTL.bit.PULSESEL = 1; //time base counter equal to 0

ePWM[pwm]->DCFCTL.bit.BLANKINV = 0; //blanking window not inverted

ePWM[pwm]->DCFCTL.bit.SRCSEL = 1; //DCAEVT2 is source signal (equivalent to DCBEVT2)

ePWM[pwm]->DCCAPCTL.bit.CAPE = 0; //enable the time-base counter capture

ePWM[pwm]->DCFOFFSET = 0;

ePWM[pwm]->DCFWINDOW = RISING_EDGE_DELAY + 1; //dead band time + time for load cap to discharge (1 * 16.7ns should be plenty)!!

ePWM[pwm]->DCFCTL.bit.BLANKE = 0; //blanking window is enabled

//SETUP TRIP ZONE FOR CURRENT CBC TRIP

ePWM[pwm]->TZSEL.bit.DCAEVT2 = 1; //CBC trip from DCAEVT2

ePWM[pwm]->TZSEL.bit.DCBEVT2 = 1; //CBC trip from DCBEVT2

ePWM[pwm]->TZDCSEL.bit.DCBEVT2 = 2; //DCBL = don't care, DCBH = high

ePWM[pwm]->TZDCSEL.bit.DCAEVT2 = 2; //DCAL = don't care, DCAH = high

if (invert) {

ePWM[pwm]->TZCTL.bit.DCBEVT2 = 2; //force B low (low side off)

ePWM[pwm]->TZCTL.bit.DCAEVT2 = 1; //force A high (high side on)

}

else {

ePWM[pwm]->TZCTL.bit.DCBEVT2 = 1; //force B high (low side on)

ePWM[pwm]->TZCTL.bit.DCAEVT2 = 2; //force A low (high side off)

}

  • Hi Matthew,

    I have not through your complete code listing, however I do see something that would be worth looking at...

    At the very end of your code you are configuring DCAEVT2 and DCBEVT2.  Please note that these actions pertain to SYSCLK-by-SYSCLK forcing of the PWM module.  They do not pertain to CBC trips.  To configure the action which happens on a CBC trip (or OSHT trip), you should be setting TZCTL[TZA] and TZCTL[TZB].

    (if my understanding is correct, you should then set the TZCTL[DCxEVTn] triggers to 'Do Nothing' to your actual PWM output)

    Hopefully this helps.


    Thank you,
    Brett

  • I'm sorry but I did not follow your reply.

    I made an attempt to disable CBC by changing the following lines of code:
    ePWM[1]->TZSEL.bit.DCAEVT2 = 1;
    ePWM[1]->TZSEL.bit.DCBEVT2 = 1;
    to:
    ePWM[1]->TZSEL.bit.DCAEVT2 = 0;
    ePWM[1]->TZSEL.bit.DCBEVT2 = 0;

    To my surprise, the CBC started working the way I had intended it to work in the first place. While I am pleased with circuit now operating correctly, I am more confused now than before. If the TZSEL register does no enable CBC, what is the purpose of that register? How would I go about also enabling an OST event?

    Thanks,

    matt
  • Hi Matt,

    I admit that the documentation involving this in the ePWM user guide can be a bit confusing.  We are actively working on making it, at least a bit, clearer.

    In the next version of the ePWM user guide, we will update the TZ figure inside that document to the attached.  This alone should help to clear up some of your questions.

    The confusion often comes because the Digital Compare (DC) submodule generates DCxEVTn signals and these signals can be used in several different ways within the TZ submodule.  Based on your last message, you may no longer actually be using CBC trips (but tripping based on SYSCLK-by-SYSCLK trips - having the ePWM go into the trip state only when DCxEVTn is low).

    /cfs-file/__key/communityserver-discussions-components-files/171/F2803x_5F00_trip_5F00_zone_5F00_submodule_5F00_5Aug2015.gif

    Hopefully this helps!


    Thank you,
    Brett