Hi,
I've been playing with CMPSS and EPWM module for a while and I would like to push what I'm doing a bit further.The goal is something similar to peak current mode operation.
Here's what I would like to achieve :
I have two signals connected to two CMPSS. CompH and CompL are used on both CMPSS to do bipolar comparison of these two signals. When one of the compH goes high, I'd like PWM1A to be forced low and if both compH are low, I'd like PWM1 to continue it's normal operation. When one of the compL goes High, I'd like PWM1A to be forced High and if both compL are low, I'd like PWM1 to continue it's normal operation.
Here's what I did for now :
Cmpss1 and Cmpss2 config:
CompHINV = 0
CTRIPHSEL = 0 (async output sent to epwmXBar)
CompLINV = 1
CTRIPLSEL = 0 (async output sent to epwmXBar)
Xbar config to connect comparators to pwm module
EPwmXbar.TRIP4.Mux0 = 0 (Comp1 CTRIPH connected to Trip4)
EPwmXbar.TRIP5.Mux1 = 0 (Comp1 CTRIPL connected to Trip5)
EPwmXbar.TRIP4.Mux2 = 0 (Comp2 CTRIPH connected to Trip4)
EPwmXbar.TRIP5.Mux3 = 0 (Comp2 CTRIPL connected to Trip5)
PWM config
DCTRIPSEL.DCAHCOMPSEL = 3 //Digital compare High is connected to TRIP4
DCTRIPSEL.DCALCOMPSEL = 4 //Digital compare Low is connected to TRIP5
TZDCSEL.DCAEVT1 = TZ_DCAH_HI; //Generate event 1 on DCAH == 1)
TZDCSEL.DCAEVT2 = TZ_DCAL_HI; //Generate event 2 on DCAL == 1)
DCACTL.EVT1SRCSEL = DC_EVT1; //Use DCAEVT1 to generate event 1 event
DCACTL.EVT1FRCSYNCSEL = DC_EVT_ASYNC; Use async signal
DCACTL.EVT2SRCSEL = DC_EVT2; //Use DCAEVT2 to generate event 2 event
DCACTL.EVT2FRCSYNCSEL = DC_EVT_ASYNC; Use async signal
TZCTL.DCAEVT1 = TZ_FORCE_LO; //Force low when compH is high
TZCTL.DCAEVT1 = TZ_FORCE_HI; //Force high when compL is high
DCFCTL.BLANKE = 0; //No blanking enabled
That's pretty much it. I haven't been able to see this working yet. I'm not sure that when the comparator output will go low if the PWM will go back to its normal state of operation (listen to duty cycle compare) or if it will be forced in the associated DCAEVTx action. The more I read the datasheet, the more I understand that this will be like a one time forced trip zone. Other piece of information, I never control PWMxB. It is automatically managed by the dead band sub module.
If anyone has insight on this, if it's doable or anything it will be appreciated!