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.

How to program DCAEVT1.sync

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.

  • Hi,

    same Problem here.
    Interrupts are generated and TZFLG is set, but no sync generation. Triggering by TZFRC[DCAEVT1] has the same effect.
    -> Config for DCAEVT1 seems to be OK.
    Next step: EPWM1SYNCO is generated when TBCTL[SWFSYNC] is set.
    -> Config for EPWM1SYNCO seems to be OK also.
    Problem must located at DCACTL[EVT1SYNCE], but it is definitely set.

    Any Idea?
  • Hi,

    What is the status of EPWMSYNCIN input? Do you have external Synchronization enabled?
    Note that DCAEVT1.sync is ORed with EPWMSYNCIN input.

    -Bharathi.
  • Hi,

    external synchronisation was disabled, Output was low and sending a sync puls with TBCTL[SWFSYNC] worked, so no Problem with ORing.

    The explanation is in this Thread:

    https://e2e.ti.com/support/microcontrollers/c2000/f/171/p/141682/525789

    1.TBCTL[SWFSYNC], DCAEVT1.sync and DCBEVT1.sync can not become EPWMxSYNCO.

    2.EPWMxSYNCI, CTR = Zero and CTR = CMPB can become EPWMxSYNCO.

    That seems to be correct, except sending sync pulses with TBCTL[SWFSYNC] worked for me.

    The documentation is erroneous. -> lot of work and a Hardwarerevision more cause of "good" TI-documentation :-(

    But got the Prototype running with some wire and a different syncing approach.