Hi,
I have a problem with the Trip Zone / ePWM module for my application.
I have a single PWM output (PWM1A) and I want to force this output low on 2 conditions (One Shot Trip Event):
- COMP1 output tripped
- COMP2 output tripped
This is quite simple. (1 PWM output with 1 overcurrent + 1 overvoltage security).
But it seems that it is impossible to manage this very simple case.
=> I control PWM1A so I have to use Digital Compare Events DCAEVT1 and DCAEVT2 (DCBEVT are not relevant).
=> So I map DCAEVT1 on COMP1, and DCAEVT2 on COMP2.
BUT !!!!! : DCAEVT2 can only be used as a source for a Cycle By Cycle Trip Zone. I want it to be a OST source.
So, I guess I misunderstood something. It MUST be possible to shutdown a PWM output from 2 conditions. But I don't know where I'm wrong.
I would appreciate your help on this matter.
Thank in advance.
Nicolas UHL
Hi Nicholas,
Which device are you using?
Kris
Sorry, I forgot to mention this important point :
I use a Piccolo TMS320F28035 device.
Regards
Nicholas,
Have you had a chance to take a look at Example_2803xEPwmDCEventTrip in controlSUITE? I believe EPWM1 is configured to be tripped by DCAEVT1 as a one shot trip.
Here's the line of code which specifically controls if it is one shot or cycle by cycle:
// Enable DCAEVT1 as a one-shot trip source // Note: DCxEVT1 events can be defined as one-shot. // DCxEVT2 events can be defined as cycle-by-cycle. EPwm1Regs.TZSEL.bit.DCAEVT1 = 1;
Looking back at your code I think I see the problem. You are using trying to use two different DC events for two events. What you want to do is configure the DCAH and DCAL for a single event. You will want to use DCAEVT1 since this can be a one shot trip.
EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = COMP1OUT EPwm1Regs.DCTRIPSEL.bit.DCALCOMPSEL = DC_COMP2OUT; // DCAL = COMP2OUT
Kris,
Thanks a lot for your answer.
But I still have a question.
DCAEVT1 can be a source for a One Shot Trip on PWMxA. DCAEVT2 can not. So I need to use DCAEVT1. OK.
I can set, as you suggest, the DCTRIPSEL register:
EPwm1Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT; // DCAH = COMP1OUTEPwm1Regs.DCTRIPSEL.bit.DCALCOMPSEL = DC_COMP2OUT; // DCAL = COMP2OUT
By this way I define 2 different signals (DCAH and DCAL).
BUT : then, how can I define DCAEVT1 to be triggered by DCAH or DCAL (as i want DCAEVT1 to be triggered on 2 conditions).
The TZDCSEL register does not allow this.
So, how can I manage it ?
Thanks in advance.
Nicolas
Nicolas,
That makes more sense. I thought this was a strange condition looking for both over voltage and over current simultaneously, but I've been asked stranger things :)
I think you may have some confusion with which DC events can be OSHT and which can be CBC. If you checkout the TZSEL bit descriptions on pg 122 of the previously linked to document, you will see that DCAEVT1 and DCBEVT1 can both be configured as OSHT trip sources. DCAEVT2 and DCBEVT2 can both be CBC trip sources.
Do you have DCBEVT1 available to use?
Yes, DCBEVT1 is available. But the issue is still alive.
Because, DCBEVT1 can only manage a PWMxB output (when I refer to the TZCTL register).
In my case, I have only one output to manage : PWM1A
Actually, my need is quite simple : I want to shutdown (in One Shot mode) my PWM1A output when COMP1 trips or when COMP2 trips.
My mistake, you are correct. What I would suggest doing is configure DCAEVT2 as CBC and software force a oneshot trip in the ISR before you clear the CBC trip flag. The CBC trip will remain in effect until the trip condition clears and TBCLK = 0. In most cases this should keep your PWM tripped until you have time to force the oneshot trip in the ISR.
In the meantime, I will speak with some colleagues to see if there is a more direct route to accomplish what you are looking to do.