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.

PWM Software forced Synchronisation

Hello

I try to synchronisate my PWM signal by software.

So i set the SWFSYNC Bit in the Timebase Control Register.

EPwm2Regs.TBCTL.bit.SWFSYNC = 1;

In the init function i set

EPwm2Regs.TBCTL.bit.SYNCOSEL = 0;

as the datasheet says.

But the counter isn't reset when the SWFSYNC Bit is set.

What do i make wrong?

EPwm2Regs.TBPHS.half.TBPHS = 0;
EPwm2Regs.TBCTL.bit.PHSEN = TB_ENABLE;

is also set so the reload value should be 0?

  • Hello

    I had a problem similar and it seems due to the use of a breakpoint too close off EPwm2Regs.TBCTL.bit.SWFSYNC = 1;

    I have try this :
        EPwm2Regs.TBCTL.bit.SWFSYNC = 1;
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");
           asm("          NOP");

    with a breakpoint after the last "NOP" and it works. It seems the instruction EPwm2Regs.TBCTL.bit.SWFSYNC = 1; need some free clock cycle too work and if you stop it before, the synchronisation do not work.