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.

Turn off EPwm out, change EPwm time base period run-time and restart

Hello,

I have the need to change run-time the period of two syncronized EPwm,

but before to do this operation I have to force LOW out A and out B not immediately

but syncronously (for example "on event counter equals zero").

To force LOW out A and out B I use bit CSFA and CSFB in the AQCSFRC register.

To do this operation syncronously I use bit RLDCSF in the AQSFRC register:

Is there a problem:

when I write "1" to CSFA,CSFB register out A,B are not set to immediately to zero,

so I can't change EPwm period immediately.

If I want to change EPwm period I have to wait CSFX effect (i.e. out X forced LOW).

Is there a way to wait this event, for example ...

While(EPwmXRegs.XXXXX.bit.YYYY==1) asm(" nop");

For now I use this code but it is not the best

While(EPwmXRegs.TBCTR>4) asm(" nop");

Can some one help me ?

  • I've try this code but I notice a problem:

    		EPwm5Regs.ETPS.bit.INTPRD	= 1;//Generate an interrupt on the first event INTCNT = 01 (first event)
    		EPwm5Regs.bit.INTSEL			= 1;//Enable event time-base counter equal to zero. (TBCTR = 0x0000)
    		EPwm5Regs.ETSEL.bit.INTEN	= 1;//Enable EPWMx_INT generation
    
    		EPwm5Regs.ETCLR.bit.INT		= 1;
    		//EPwm5Regs.ETCLR.bit.INT		= 1;
    		while(!EPwm5Regs.ETFLG.bit.INT) asm(" nop");

    If I call EPwm5Regs.ETCLR.bit.INT = 1 once EPwm5Regs.ETFLG.bit.INT is NOT cleared,

    so I have to call EPwm5Regs.ETCLR.bit.INT = 1 twice