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.

TMS320F280023: Issue with CMPSS

Part Number: TMS320F280023

Hello, experts,

I am facing an issue when using the CMPSS module. My settings are as under- 

void CompInit()
{
    EALLOW;
    CmpssRegs4.COMPCTL.bit.COMPDACE = 1;    // Power up comparator
    CmpssRegs4.COMPCTL.bit.COMPHSOURCE = 0; // Internal DAC to be used for inverting input
    EDIS;
}
.
.
.
.
.
.
void EpwmUpdate ()
{
    EALLOW;
    EPwm2Regs.TZCTL.bit.TZA = 2;
    EPwm2Regs.TZDCSEL.bit.DCAEVT2 = 2;
    EPwm2Regs.DCAHTRIPSEL.bit.TRIPINPUT4 = 1;
    EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = 3;
    EPwm2Regs.TZSEL.bit.DCAEVT2 = 2;
    EPwm2Regs.TZEINT.bit.DCAEVT2 = 1;
    EPwmXbarRegs.TRIP4MUX0TO15CFG.bit.MUX6 = 0;
    EPwmXbarRegs.TRIP4MUXENABLE.bit.MUX6 = 1;
    EDIS;
}

My application is to implement a Peak Current Mode Control. Our observations are as under-

Whenever we increase the DAC value or give the reference DAC value the first time, there is a major overshoot of current.

I tried adding the following line in the CompInit() function - 

AnalogSubsysRegs.CMPHPMUXSEL.bit.CMP4HPMUXSEL = 1;

However, then a current would flow even with DAC value set as 0.

I suspect that I have done some errors in setting up the tripping actions.

Requesting the forum's help to resolve this issue!

  • Hi Aditya,

    Can you provide more details on your question so we can better help you?

    Whenever we increase the DAC value or give the reference DAC value the first time, there is a major overshoot of current.

    Can you expand on the statement above? Increased the DAC value to what? What current is overshooting? Isn't the current an input?

    Please also provide a high level overview of the connections you have made to the device pins to the CMPSS.

  • Hi Frank,

    Please find a system overview as under - 

    1. We are using the high side comparator of CMPSS4 using the pins A7/C3 (Pin 15).

    2. The non-inverting input comes from a current sensing section (0 - 3.3V) on our board. The inverting input is given through the internal DAC (say DACVal).

    3. The EPWM2A is connected to a switching device through which a current flows (say Ia).

    4. Depending on the current required, we set the DACVal to a certain value.

    My aim is to execute the following actions - 

    1. EPW2A is turned ON

    2. Ia is measured and a corresponding signal is given back to the uC. Let's say this signal is Va

    3. Whenever Va goes beyond DACVal, a trip signal is generated that turns OFF EPWM2A.

    4. Go to 1 and cycle continues.

    My observations are as under - 

    1. During the first few cycles after being turned ON, the EPWM2A doesn't trip even when the Va value goes beyond DACVal.

    2. This behaviour is also seen whenever we increase the DACVal by a few counts (around 10 at a time).

    3. This goes against the requirement wherein the switch (EPWM2A) should have been turned OFF immediately after the feedback signal (Va) went beyond the reference.

    4. Hence, this causes an overshoot in the output current (Ia) of the system.

    Hope I'm able to explain it sufficiently!

  • Hi Aditya,

    Thanks. This is much better and the issue is more clear to me now. Responses and questions below:

    1. We are using the high side comparator of CMPSS4 using the pins A7/C3 (Pin 15).

    Got it. In that case, this configuration code you had before is correct "AnalogSubsysRegs.CMPHPMUXSEL.bit.CMP4HPMUXSEL = 1"

    2. The non-inverting input comes from a current sensing section (0 - 3.3V) on our board. The inverting input is given through the internal DAC (say DACVal).

    I take it the current sensing non-inverting input you are referring to here is A7/C3 (Pin 15) above?

    3. The EPWM2A is connected to a switching device through which a current flows (say Ia).

    4. Depending on the current required, we set the DACVal to a certain value.

    This is also clear. What is setting DACVAL in this case? An interrupt?

    My aim is to execute the following actions - 

    1. EPW2A is turned ON

    2. Ia is measured and a corresponding signal is given back to the uC. Let's say this signal is Va

    3. Whenever Va goes beyond DACVal, a trip signal is generated that turns OFF EPWM2A.

    4. Go to 1 and cycle continues.

    This flow makes sense. I'm assuming you have already confirmed that the I to V conversion has the correct polarity? By this i mean you have confirmed that when Ia increases, Va also increases.

    1. During the first few cycles after being turned ON, the EPWM2A doesn't trip even when the Va value goes beyond DACVal.

    You mention "during the first few cycles". Does the issue resolve after a while? Can you check the COMPSTS register when this happens to see if it tripped?

    You might also have to bring out the CTRIPOUTH on a GPIO through the Output Xbar for debug purposes. This way, we can confirm whether or not the comparator is tripping properly.