Hello everybody
I try to sync my PWM Signal through the DCAEVT1. My code looks like this:
EPwm2Regs.TBPRD = 1000;
EPwm2Regs.TBPHS.half.TBPHS = 0;
EPwm2Regs.TBCTL.bit.CTRMODE = TB_COUNT_UP;
EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;
EPwm2Regs.TBCTL.bit.HSPCLKDIV = TB_DIV1;
EPwm2Regs.TBCTL.bit.CLKDIV = TB_DIV1;
EPwm2Regs.TBCTL.bit.PRDLD = TB_SHADOW;
EPwm2Regs.AQCTLA.bit.ZRO = AQ_SET;
EPwm2Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;
EALLOW;
EPwm2Regs.DCTRIPSEL.bit.DCAHCOMPSEL = DC_COMP1OUT;
EPwm2Regs.TZDCSEL.bit.DCAEVT1 = TZ_DCAH_LOW;
EPwm2Regs.DCACTL.bit.EVT1SRCSEL = DC_EVT1;
EPwm2Regs.DCACTL.bit.EVT1FRCSYNCSEL = DC_EVT_SYNC;
EPwm2Regs.TZSEL.bit.DCAEVT1 = 1;
EPwm2Regs.DCACTL.bit.EVT1SYNCE = 1;
EPwm2Regs.TZEINT.bit.OST = 1;
EDIS;
When the DCAH goes low the DCAEVT1 occurs and the controller jumps into the interrupt service routine, but there is no synchronisation and no reset of the Timebasecounter. The PHSEN bit is set and the TBPHS value is also zero.
Does anybody see the mistake i made?
With a software forced synchronisation in the interrupt service routine it works, but i need to realize it with the DCAEVT1.sync.
Thanks for your help.