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.

TMS570LC4357: Generating the events with PWM

Part Number: TMS570LC4357

Hi,

I want to generate two events with eTPWM configuration. (1) On start of each PWM cycle. (2) at 50% of TBPRD value. For (1) I am using eTPWM Interrupt event, and for (2) want to use SOCB. I am able to generate the events as required only at 50% duty cycle. For all other value of duty cycle change, the SOCB trigger is changing the timing. Do we have a solution which can create reliable events. 

Best Regards,

Chandra

  • Chandra,

    The ETSEL register allows you to define the timing of the interrupt generation as well as the timing of the SOC generation. This configuration is independent of the PWM generation controls AQCTLx.

    Which compare value are you using to generate the PWM? You can use the second compare value to control the SOC timing.

    Regards, Sunil

  • Hi Sunil,

    I have tried to use the different options including CTR_PRD.

    I have used the toggle GPIO to monitor the event execution for different selections.

    I have one toggle in etpwmNotification function and one toggle in adcNotification function. I am expecting the one toggle shall happen at start of PWM and the other at the mid counter value. 

    On the scope I have observed both at start of PWM. 

    With the option CTR_UP_CMPA, I could able to achieve the adcNotification happening at mid of PWM with 50% duty cycle. But this trigger is changing with duty cycle. 

    I am not sure what configuration is wrong. Looking for help.

    Best Regards,

    Chandra

  • Hi Chandra,

    The variation in duty cycle is done by configuring the CMPA value. Your SOC generation is also based on the CMPA value (by virtue of you selecting CTR_UP_CMPA as condition for SOCB generation. You can change the SOCB generation to be dependent on CMPB value, which you can configure independent of CMPA. Then your SOCB timing will not depend on the duty-cycle configuration.

    If you are using both CMPA and CMPB to control the duty cycle of the two separate PWMs, you can enable another ePWM module to generate the SOC timings you want. Each ePWM module can be synchronized to the same time base.

    Regards, Sunil

  • Excellent. This solved my problem. Thanks Sunil.