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.

LAUNCHXL-F280039C: Synchronized activation and termination of EPWMs by trip zone

Part Number: LAUNCHXL-F280039C

Hi,

I'm working on HAL layer for PWM.

I want to let the application layer the ability to activate and terminate the PWMs in sync.

I do it by trip zone usage according to your example.

I use PWM1, PWM2 and PWM4.

The syncOutPulseSource of all the PWMs is EPWM_SYNC_OUT_PULSE_ON_CNTR_ZERO.

The syncInPulseSource of PWM2 and PWM4 is EPWM_SYNC_IN_PULSE_SRC_SYNCOUT_EPWM1.

The phase shift is enabled but the counter is 0.

The PWMs share the same parameters of time base and counter compare.

I see that when I reset the trip zone IO the termination of the PWMs is synchronized:

 

and the gap between the IO reset to the PWMs termination is 30ns which is OK.

However, when I set the trip zone IO to activate the PWMs there is a delay between them:

The gap between the IO setting and the activation of PWM1, the first PWM to become active , is 8.35us.

The gap between the activation of PWM1 to PWM2 is ~2us and the gap between the activation of PWM2 to PWM4 is also ~2us.

Please advise how to sync the activation of all the PWMs.

Thanks,

Dekel

 

  • Hi Dekel, 

    Sorry for the delayed response. Can you share your code here so I could debug from my end. 

    Best, 

    Uttam

  • 0844.TripZone.zipHi Uttam,

    Based on your epwm_ex1_trip_zone example, please provide a code and configuration that let the user an ability of synchronized activation and temination of EPWM1 and EPWM2, when EPWM2 sync in source is the sync out signal of EPWM1 and both use same time based configuration.

    The SW should control it by writing to the trip zone IO in one shot mode.

    Thanks,

    Dekel

  • Hi,

    I'm interrested in your problem because I have also a synchronization problem on the F280039. (I don't know if i have to open another subject).

    I can't synchronize several PWM, the synchonization is based on rising edge of PWM 1A.

    When i observe the SyncOut signal, it appears 8,46µs before the rising edge of PWM 1A ???

    SyncOut should appear after the rising edge of PWM 1A.

    I tried alos for the falling edge it appears 8,46µs before the falling edge of PWM 1A (if i used CMPBEN as condition for SyncOut).

    Dekel,

    You wrote :The syncOutPulseSource of all the PWMs is EPWM_SYNC_OUT_PULSE_ON_CNTR_ZERO.

    Does that mean you set EPWMSYNCOUTEN.ZEROEN to 1 for all the PWM ?

    My understanding, EPWMSYNCOUTEN is used for only 1 PWM as a condition in order to generate the SyncOut signal (only one for all PWM). 

    In Reference manual: EPWMSYNCOUTEN.ZEROEN = 1 means The EPWMxSYNCOUT signal is pulsed for one PWM clock period upon the value of TBCTR changing to 0x0000.

    If you set it to all the PWMs, all the PWMs will be linked and try to set 1 signal SyncOut and it can be a problem ?

    Regards,

    Christophe

  • Hi,

    I found the reason why my PWMs where not synchronized.

    In reference manual for F280039: §20.4.3.3:


    EPWMxSYNCI: Synchronization Input Pulse:
    The value of the phase register is loaded into the counter register when an input synchronization pulse is detected (TBPHS → TBCTR). This operation occurs on the next valid time-base clock (TBCLK) edge.

    Synchronization occurs on the next valid time-base clock (TBCLK) edge and NOT on system clock edge.

    I change the TBLCK of all PWMs in order to have the same TBCLK and now, they are synchronized.

    Regards,

    Christophe

  • Hi Christophe,

    As the sync issue is resolved now, I will go ahead and close this thread. 

    If you need any further support let us know. 

    Thanks & Regards,

    Uttam Reddy

  • HI Dekel,

    Here is the code with proper synchronization with three EPWMs 1,2 and 4. epwm_ex1_trip_zone.zip

    I have created using the external GPIO interrupt, instead of GPIO11 used GPIO25 (change input with 3.3V or zero) on launchpad. Please follow the same synchronization scheme and replicate. Let me know if you have any questions. 

    Thanks & Regards,

    Uttam Reddy

  • Hi Uttam Reddy,

    Thanks, but, this was not my thread, I use the Dekel thread because i beleive they were close.

    So I let Dekel close it.

    Regards,

  • Hi Uttam,

    Thanks for the code example you sent.

    I need to trigger the synced activation or termination of the PWM lines by SW, so external GPIO interrupt doesn't help.

    Please provide a code example that let the SW the ability to control it without external voltage.

    It means that an output GPIO is defined for the trip zone input xbar and the SW writes its value.

    Regards,

    Dekel

  • Hi Dekel,

    If you configure the GPIO driving the trip zone as an input/output, you can simply trigger the trip zone by writing a value to the GPIO register. In SW where you want this to happen, you may use the GPIO_writePin() function and drive the GPIO to the desired output which corresponds to activation/termination of the PWMs. This will not require any external voltage on the GPIO pin

    Regards,

    Peter

  • Hi TI

    Can you advise how to SYNC PWM with SOFTWARE?

    NO EXTERNAL IO...

  • Hi Aviv & Dekel,

    As the issue is resolved over call, I am going to close this thread.

    Incase of any addtional support needed related to this project, feel free to reach out to us directly. 

    Thanks & Regards,

    Uttam Reddy