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.

SyncIn with external source

Other Parts Discussed in Thread: TMS320F28044

Hi.

I use the TMS320F28044 to generate the PWMs for a six phase DC DC converter with High Resolution. Currently the ePWM1 is the master and generate the SYNCO at CTR=ZERO. The other ePWMx are synchronized with the SYNCO from the master.

 

Now I will synchronize the master with a external trigger signal via a input pin. What I have to do? Which registers must be configured and what pin I have to use for the trigger signal? This controller has two EPWMSYNCI input pins. I found nothing in the documentation (Maybe I haven't searched enough).

 

Thanks

 

Regards

Sebastian Utz

  • The

    From the ePWM manual.

    Time-base synchronization input (EPWMxSYNCI) and output (EPWMxSYNCO) signals.
    The synchronization signals daisy chain the ePWM modules together. Each module can be configured
    to either use or ignore its synchronization input. The clock synchronization input and output signal are
    brought out to pins only for ePWM1 (ePWM module #1). The synchronization output for ePWM1
    (EPWM1SYNCO) is also connected to the SYNCI of the first enhanced capture module (eCAP1).

    So you can synchronize only the ePWM1 module with the EPWMxSYNCI signal. Then you will have to configure the ePWM1 module to take this as a sync signal and if you want to sync all wPWM modules to this same signal then use this as a ePWM1 module syncout signal and not the CTR=0 . You will also have to define in GPIO settings that the pin is for EPWMSYNCI. I hope this helps.

    Example:

    PWM:

    EPwm1Regs.TBCTL.bit.PHSEN = TB_ENABLE; // Load the time-base counter with the phase register when an EPWMxSYNCI input signal occurs or
    when a software synchronization is forced by the SWFSYNC bit

    EPwm1Regs.TBCTL.bit.SYNCOSEL = TB_SYNC_IN;   // source of the EPWMxSYNCO signal: EPWMxSYNC

    GPIO:

    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 2;        // 0=GPIO32      1=SDAA      2=EPWMSYNCI  3=/ADCSOCAO

     

    JHi

  • Thank you. I will try it.

  • Hello JHi,

    I would like to synchronize the pwm1 with an external trigger source @10us, so I set:

    --------------------------------------------------------------

    EPwm1Regs.TBCTL.bit.PHSEN = TB_ENABLE;

    GpioCtrlRegs.GPBMUX1.bit.GPIO32 = 2;

    --------------------------------------------------------------

    but i see that the Pwm Interrupt  is called  twice.

    Internal counter and external source both call the PwmInterrupt because counter is set to ZERO.

    ( EPwm1Regs.ETSEL.bit.INTSEL =  ET_CTR_PRDZERO;)

    Of course this generates several problems.

    How can I avoid the pwm ramp to start again without the external trigger?

    Thanks

    M.

  • It is supposed to start the ramp again, otherwise it is not synchronized. But what you should do is to change interrupt to trigger from period not zero.

    EPwm1Regs.ETSEL.bit.INTSEL = ET_CTR_PRD.

  • In my case I need to generate pwm interrupt at zero for other reasons.

    I wonder if there is the possibility to change the pwm period

    in order to lock the external trigger  without "breaking" the counter ramps.

    Thanks

    M.

  • One possibility would be to add 2 to phase shift. Then the clock would not go to zero but to 2 and it will also compensate delay from the sync signal.

    EPwm1Regs.TBPHS.half.TBPHS = 2;     // Compensation to delay (2*SYSCLKOUT) of the sync signal

  • It works if the external trigger is late, but if it comes earlier there is no counter=0 and no interrupt generation.

    I will use GPIO32 as generic GPIO to perform a smooth adjustment of pwm_period.

    M.

  • Would it be then possible to disable the interrupt from ePWM unit and do the same stuff in external interrupt function? You could still leave the synchronization.

  • Yes, the solution is to disable all interrupts called by counter=zero.

    Now I have Epwm interrupt called by external trigger.

    M.