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.

TMS320F28386S: Equal ON time duration for EPWM A and EPWM B outputs based on CMPSS compare event

Part Number: TMS320F28386S
Other Parts Discussed in Thread: C2000WARE

Hello, I wanted to generate a symmetrical waveform on EPWMA and EPWMB pins with equal on time. The EPWMA output is changed to low when an external CMPSS compare event occurs. The the duration for which the EPWMA output is ON, for same duration EPWMB output shall also be ON. Please refer attached image for clarification where the "A ON" and "B ON" duration shall be same keeping constant frequency with compare event for CMPSS based on external current sensor input.

Please suggest if this is possible with C2000 MCU, if so please suggest what method can be used to achieve it.

  • Hi Vishal,

    Refer to our C2000ware, EPWM example 1 (trip zone module) which demonstrates the CMPSS trip via a GPIO on the EPWM.

    I dont think A_ON & B_ON having the same duration because the CMPSS event occurance can vary whereas you can set to clear trip at period/zero/CMPx values.

    Best,

    Uttam

  • Hi Vishal,

    Yes, this looks feasible by using C2000. enabling DC couter compare in EPWM module with below functions

    EPWM_enableDigitalCompareCounterCapture(myEPWM0_BASE); & 
    EPWM_setDigitalCompareCounterShadowMode(myEPWM0_BASE, true); 
     where you capture your trip event and shadow load it to CMP_B and set the AQ for EPWM2B accordingly. Let me know if you have any further queries. 
    Best Regards,
    Uttam Reddy Pailla
  • Hello Uttam, Thank you for the solution. I think this will solve my purpose, this is the exact mechanism which I am looking for.

    Just an additional question, The Captured TBCNTR value by DC Capture module shall be manually shadow loaded to COMP_B register in ISR or any in build mechanism to load it automatically ?

    Thanks,

    Vishal

  • Vishal,

    It can be done automatically through EPWM_setDigitalCompareCounterShadowMode() which is much simpler. 

    You can also do via ISR but not recomended. 

    Best Regards,

    Uttam Reddy Pailla