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.

Triggering of EPWM using CMPSS

Other Parts Discussed in Thread: C2000WARE

Hello all,

I m one step further with my CMPSS, managed to trig an otuputxbar.. then trying to trig an epwm xbar...

Code looks like that in CMPSS:

"EALLOW"

/* Asynch output feeds CTRIPH and CTRIPOUTH */

Cmpss6Regs.COMPCTL.bit.CTRIPHSEL = CTRIP_ASYNCH;

Cmpss6Regs.COMPCTL.bit.CTRIPOUTHSEL = CTRIP_ASYNCH;

/* Asynch output feeds CTRIPL and CTRIPOUTL */

Cmpss6Regs.COMPCTL.bit.CTRIPLSEL = CTRIP_ASYNCH;

Cmpss6Regs.COMPCTL.bit.CTRIPOUTLSEL = CTRIP_ASYNCH;

/* Configure CTRIPOUTH output pin */

/* Configure OUTPUTXBAR3 to be CMP2 CTRIPOUTH */

OutputXbarRegs.OUTPUT3MUX0TO15CFG.bit.MUX10 = 1; //modification CMPSS6.CTRIPOUTH_OR_CTRIPOUTL

/*Enable OUTPUTXBAR3 Mux for Output*/

OutputXbarRegs.OUTPUT3MUXENABLE.bit.MUX10 = 1;

/* Configure Trip 10 to PWM module */

EPwmXbarRegs.TRIP10MUX0TO15CFG.bit.MUX10 = 2;

/* Enable */

EPwmXbarRegs.TRIP10MUXENABLE.bit.MUX10 = 1;

EDIS.

 

Then in EPWM module i tried the code from "cmpss_asynch_cpu01" simply changing from  DCB to DCA and setting it to trip 10.

My code looks like that:

//Configure EPWM1 to output low on DCA EVT TRIP

EPwm1Regs.TZCTL.bit.DCAEVT1 = TZ_FORCE_LO;

//Configure DCA to be TRIP10

EPwm1Regs.TZDCSEL.bit.DCAEVT1 = TZ_DCAH_HI;

EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = 0x9;

EPwm1Regs.DCTRIPSEL.bit.DCALCOMPSEL = 0x9;

EPwm1Regs.DCAHTRIPSEL.bit.TRIPINPUT10 = 1;

 

//

//Configure DCAEVT1 as OSHT

//

EPwm1Regs.TZSEL.bit.DCAEVT1 = 1;

//

//Configure DCA path to be unfiltered & async

//

EPwm1Regs.DCACTL.bit.EVT1SRCSEL = DC_EVT1;

 EPwm1Regs.DCACTL.bit.EVT1FRCSYNCSEL = DC_EVT_ASYNC;

// enable INT

EPwm1Regs.TZEINT.bit.OST = 1;

 

I do see the outputxbar going high but no flag or reaction in PWM module.

CAn you highlight how a tripin10 trips the DAC module please?

Thank you,

PA .

 

  • Hi PA,

    Your EPWM Xbar configuration is not quite correct.

    EPwmXbarRegs.TRIP10MUX0TO15CFG.bit.MUX10 = 2

    should be

    EPwmXbarRegs.TRIP10MUX0TO15CFG.bit.MUX10 = 1

    same as you have configured for the Output Xbar. Mux option 2 is not a CMPSS option.

  • OK!

    The confusion is in table 9-2, for epwm x-bar Mux configuration, It is specified to use "2" for CMPSSXTRIPH_OR_TRIPL

    Whereas for output X-bar mux configuration, in table 9-3, it is specified to use "1"   for CMPSSXTRIPH_OR_TRIPL.

    I thought this was the way to make a difference between outut and epwm x-bars.

    I m going to set up the mux as you say. (double checked in the code example, indeed is the 0 to set up the mux!... Sorry..)

    Thank you,

    PA .

  • Ahh, I see where the confusion is coming from. Looks like table 9-2 is indexed from 1 instead of 0. I'll file a bug to get that updated. Thanks for pointing it out.
  • Thank you for the support Franck!

    I mananged to perfectly trigger all conditions needed for my overcurrent and voltage protection, One shot and Cycle by cycle...Amazing feature!

    Once you advised me, i could also trigger an "ECAP" counter by an output of CMPSS.. I m trying and find an easy way to measure some speed while my input is an analog signal...  

    Could you precise a bit more please ? 

    Is it using XBar output or EPWM?  

    Can i find some example or littérature please?

    Thank you!

    PA.

  • PA,

    Yes, the ECAP can be used to capture and timestamp CMPSS trips. Can you elaborate a bit more on how exactly you want to use the CMPSS with the ECAP?
  • OK.

    The idea is to measure speed using a passage through 0 of an emf without using interrupts or hal Sensors.
    We want to measure the timestamps between two "equal" (in a range) value of the emf set into an analog signal between 0 and 3.3V.

    Therefore my idea is to trigger the ECAP when the analog value of the signal reaches the adequate range then trigger again at same passage of same value...

    The signal could also be a top from from an unknown meauring device (to define by electonics engineer...)

    The timepstamp of the ECAP would give us an idea of the speed.

    Thank you,
    PA.
  • PA,

    Yes, that should work. You can setup the ECAP to timestamp the CMPSS trips -> rising/falling or any combination in between. The delta between the timestamps then gives you the speed. We have an ECAP capture example in C2000Ware called "ecap_ex2_capture_pwm". Take a look at that and let us know if you have any questions.
  • Hello Franck,

    Thanks for the confirmation.

    The example is good for ECAP but i miss the way to perform the link between CMPSS and ECAP.

    I can output the CMPSS comparison results on a EPWM-Xbar or an Output X-bar.

    I didnt get yet which is the best way to connect the CMPSS to the ECAP, do you know where is the information available?

     Thank you!

    PA.

  • I found the mux in the ECAP registers...
    I m going to test this CMPSS to ECAP..
    Thank you!