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.

MCU-PLUS-SDK-AM263X: ePWM power down

Part Number: MCU-PLUS-SDK-AM263X

Hi 
I would like to turn off the ePWM in order to reduce the power consumption. I have used the EPWM_setTimeBaseCounterMode function to set the Counter mode to EPWM_COUNTER_MODE_STOP_FREEZE for this purpose but I am not sure if this is the best way to reduce the power.

What is the best way to completely power down the PWM so that the minimum power is consumed

BR

Saman

  • Hi Saman

    The best way would be to disable clock source to the PWM module. And after the clock is re-enabled to the PWM module, the configurations need to be taken care.

    The code Flow is, to

    • Use the EPWM instance to get the base address of the required PWM module
    • unlock the MMR
    • then gate the EPWM clock,
    • and then lock the MMR again.

    Writing 7 to this register will gate the PWM module and writing 0 will un-gate it.

    Macro to gate the clock

    #define CSL_CONTROLSS_CTRL_ETPWM0_CLK_GATE_CLK_GATE_MASK                 (0x00000007U)
    Macro to un-gate the clock
    #define CSL_CONTROLSS_CTRL_ETPWM0_CLK_GATE_CLK_GATE_RESETVAL             (0x00000000U)
    The following code flow can be followed for the same:

    Hence, we propose the following solution:

     

    • Configure the EPWM
    • Gate the clock to EPWM instane- (SOC_gateEpwmClock)
    • {
    • ///EPWM will not generate any events
    • ///EPWM registers cannot be accessed.
    • }
    • If required EPWM module un-gate it using - SOC_ungateEpwmClock

     

    Another solution could be:

    • Don’t configure EPWM instance
    • Gate the clock to EPWM instanc - (SOC_gateEpwmClock)
    • {
    • ///EPWM will not generate any events
    • ///EPWM registers cannot be accessed.
    • }
    • If required EPWM instance un-gate it using - SOC_ungateEpwmClock
    • Now initialize and configure the required options.

    SOC_ungateEpwmClock API is currently not available in the SDK. I will create a request for the same - MCUREQ-1480

    SOC_gateEpwmClock API is found in this path --> C:\ti\mcu_plus_sdk_am263x_08_05_00_24\source\drivers\soc\am263x\soc.c

    Macros for the same are in this path --> C:\ti\mcu_plus_sdk_am263x_08_05_00_24\source\drivers\hw_include\am263x\cslr_controlss_ctrl.h

    Thanks & Regards

    Sri Vidya

  • To Gate the clock to EPWM instance, the following API can be used:

    void SOC_gateEpwmClock(uint32_t epwmInstance)
    {
        uint32_t baseAddr = CSL_CONTROLSS_CTRL_U_BASE + CSL_CONTROLSS_CTRL_ETPWM0_CLK_GATE + (0x4*epwmInstance);
    
        /* Unlock CONTROLSS_CTRL registers */
        SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, CONTROLSS_CTRL_PARTITION0);
    
        CSL_REG32_WR(baseAddr, CSL_CONTROLSS_CTRL_ETPWM0_CLK_GATE_CLK_GATE_MASK);
    
        /* Lock CONTROLSS_CTRL registers */
        SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, CONTROLSS_CTRL_PARTITION0);
    }
    To un- Gate the clock to EPWM instance, the following API can be used:
    void SOC_ungateEpwmClock(uint32_t epwmInstance)
    {
        uint32_t baseAddr = CSL_CONTROLSS_CTRL_U_BASE + CSL_CONTROLSS_CTRL_ETPWM0_CLK_GATE + (0x4*epwmInstance);
    
        /* Unlock CONTROLSS_CTRL registers */
        SOC_controlModuleUnlockMMR(SOC_DOMAIN_ID_MAIN, CONTROLSS_CTRL_PARTITION0);
    
        CSL_REG32_WR(baseAddr, CSL_CONTROLSS_CTRL_ETPWM0_CLK_GATE_CLK_GATE_RESETVAL);
    
        /* Lock CONTROLSS_CTRL registers */
        SOC_controlModuleLockMMR(SOC_DOMAIN_ID_MAIN, CONTROLSS_CTRL_PARTITION0);
    }
  • Thanks, I used the SOC_gateEpwmClock to deactivate the pwm instance successfully but when I did it, after reloading the code, the MCU does not boot up and needs to be turned off and on again in order to work again.


  • Hi Saman,

    when you are launching the GEL scripts for CPU Reset, could you try enabling/un-gating the EPWM clock, so that every time you perform CPU Reset, it will un-gate your PWMs?

    Is this what you are expecting?

    Do you see the power on not happening because of the PWM clock gating?

    Thanks & Regards

    Sri Vidya