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.

TMS320F280039C: PWM ON and OFF Issue

Part Number: TMS320F280039C
Other Parts Discussed in Thread: SYSCONFIG

Team,

One of our customers is trying to use ePWM module of  F280039C device. They used SysConfig tool to initialize the module. They wanted to turn ON/OFF the PWM during runtime based on some system conditions. They have the requirement as below - 

1. They're using two functions StartPWM() and StopPWM() to enable/disable the module. By disabling, we mean the PWM should be driven low continuously. When enabled i..e calling the StartPWM() function, it should function as configured using SysConfig initially.

2. Currently, they are implementing this as below. Similarly for StartPWM(), setting the values to high/low as required.

Do we have any effective way to do this instead of driving each of the PWM modules low/high such as using the ePWM Trip Zone submodule through software/forcing trip signal through software ?

With the current implementation, they are getting a dead pulse for the initial time when they are starting the PWM. 

Please help with the correct way to implement the above requirements using C2000's ePWM module.

Regards,

Sai.

  • Hello Sai,

    I'm going to give 3 suggestions, given in order of ease of implementation. I recommend suggesting them one at a time, starting with the first, and if that option doesn't work, move on to the next.

    1. A pretty common implementation I've seen people prefer is setting TZFRC[OST] = 1, which immediately forces an OST to disable the PWM. Then, when it is to be re-enabled, TZCLR[OST] = 1 clears the latch. This next part is a bit less common, but if you want to re-enable the ePWM and have it start immediately, it may be necessary. Set up an interrupt at TBCTR=ZRO. This interrupt checks whether the user has set a flag indicating they wish to re-enable the PWM, and if so, sets TBCTR=0, TZCLR[OST] = 1.

    2. Alternatively, if there's a spare GPIO, what could be done is having that GPIO routed through the input X-Bar to the ePWM trip zone to set a CBC trip which drives ePWMA/B low. If TZCLR[CBCPULSE] = 00 (default), then once the condition has been removed, the next time CTR=ZRO, the system automatically re-enables. In this setup, all the user needs to do is control the current state of a GPIO to start/stop the ePWM- this can be done through a wire or by just setting the GPIO via software. Additionally, any number of ePWMs can be driven by the same GPIO.

    3. Finally, the AQCSFRC register can be used to force the current state of the system.
      1. For one ePWM, this is very simple- though the deadband settings must be kept in mind, and if ePWMB is set to be an inverted version of ePWMA, then it won't work.
      2. For multiple, it gets a bit more complicated.
        1. Set up the AQCSFRC register to use shadow loading, then set up the system such that GLDCFG[AQCSFRC] = 1 and GLDCTL[OSHTMODE] = 1 for all ePWMs.
        2. Set all relevant ePWMs to be linked to one primary via EPWMXLINK[GLDCTL2LINK].
        3. When the user wants to disable the ePWMs, set all ePWM's AQCSFRC registers appropriately (usually to 01, but if the deadband inverts any signals, these require 10). Nothing will happen yet due to the shadow loading settings.
        4. Then, to the primary ePWM, set GLDCTL2[OSHTLD] = 1. This disables all ePWMs at the same time. To re-enable, clear the AQCSFRC registers for all ePWMs, then to the primary ePWM, set GLDCTL2[OSHTLD] = 1. You can either cause all of these to happen instantly (via GLDCTL[GLDMODE] = 1111 (GLDCTL2[GFRCLD] = 1)) or at the next chosen event- I recommend GLDCTL[GLDMODE] = 0 (the CTR=ZRO event).

    Regards,
    Jason Osborn
    Note: The key points of this post are bolded.