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.

digital compare with multiple sources

Other Parts Discussed in Thread: TMS320F28035, CONTROLSUITE

Hello,

I need to use multiple comparator outputs (COMP1OUT, COMP2OUT) to trip the same PWM channel in the Piccolo B MCU. Is it possible?

DCTRIPSEL seems to accept only one source for tripping. I need to have an over-current protection with one comparator and an over-voltage protection with another and both have to trip the same PWM channel (cycle-by-cycle).

Seems to be a big constraint that one PWM can use only one comparator output for cycle-by-cycle protection. 

The only option that I see is configuring the comparator outputs pins (e.g. GPIO42 & 43 in TMS320F28035) and connecting them outside to a TZ input... I don't like it but seems to be the only possible solution.

Thanks for your help,

Max

  • Max,

    You can do two COMP events per ePWM module.

    It looks like you want to do One-Shots for current/voltage protection, so you will want to use the H edges. If you were doing the Cycle-By-Cycle you would use the L edge.

    EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; 

    EPwm1Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP2OUT;

    Look at the LED Lighting Kit in www.ti.com/controlsuite , there is an an example of this.

     

  • BTW - if you did need to do a third compare event on any ePWMx module, outputing through a GPIO and in to TZ1-3 is what you would have to do.

  • Hello Chris,

    Thanks for your respnse. But I'm a little confused here.

     

    1) From this comment in the example that you mention (Lighting_DCDC-Main.c), line 830:

       " // What do we want the DCAEVT1 and DCBEVT1 events to do? - DCAEVTx events can force EPWMxA "

    I understand that DCAEVTx can force EPWMxA and DCBEVTx can force EPWMxB. I need to force both channels because I have a bridge topology.

    If this is correct and I use your suggestion, COMP1OUT will force channel A and COMP2OUT will force channel B. I need both channels forced by both comparators.

    2) The other confusion is that, based on the datasheet, I understand that DCxEVT1 if for one-shot and DCxEVT2 if for cycle-by-cycle. The difference between using H edges or L edges is not clear for me. 

     

    Could you please clarify these two things?

    Thanks,

    Max

  • Max,

    the H and L are just ways of having multiple sources for the trip through the Digital compare unit, the DC unit does more than just read the comparator output and pass it to trip zone module. It can be used for filtering a trip signal etc not just digital comparator output.

    agreed that only two same type (i.e either osht or cbc) of comparator trip sources can be configured as trip zones. but the module can support two sources for one shot and one for cycle by cycle. this is where H and L come into play   The trip zone mechanism needs to be understood from two perspectives, one is the DC sub module and the other is the Trip zone module.The following example would set up one shot trip from comparator 1 and 3, and cycle by cycle from comparator 2.

    the DC module gets the pulses from the comparator, here first the pulses from the Comparator are recognized as trips using

    EPwm4Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = Comparator 1 output

    EPwm4Regs.DCTRIPSEL.bit.DCALCOMPSEL = DC_COMP2OUT; // DCAL = Comparator 1 output

    EPwm4Regs.DCTRIPSEL.bit.DCBHCOMPSEL = DC_COMP3OUT; // DCBH = Comparator 1 output

    Once these internal signals are mapped to the compare output, they can be qualified to generate DCAEVT1 and DCBEVT1 for the one shot and DCAEVT2 for the cycle by cycle

    EPwm4Regs.TZDCSEL.bit.DCAEVT1 = TZ_DCAH_HI;

    EPwm4Regs.TZDCSEL.bit.DCBEVT1 = TZ_DCBH_HI;

    EPwm4Regs.TZDCSEL.bit.DCAEVT2 = TZ_DCAL_HI;

    (if you look at the register description of the TZDCSEL you would find that either DCAH or DCAL signals can be used to source the DCAEVT1 or DCAEVT2, note L and H are just used to qualify inputs from different trip sources, this is done so that the filtering option of the DC unit can be used by other trip sources as well if need be). 

    Now you enable the DCAEVT1 and DCBEVT1 to be recognized as the trips, 

    EPwm4Regs.TZSEL.bit.DCAEVT1 = 1;

    EPwm4Regs.TZSEL.bit.DCBEVT1 = 1;

    EPwm4Regs.TZSEL.bit.DCAEVT2 = 1;

    EPwm4Regs.TZCTL.bit.TZA = TZ_FORCE_LO; // EPWM4A will go low


    EPwm4Regs.TZCTL.bit.TZB = TZ_FORCE_LO; // EPWM4B will go low