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.

Linux/AM3352: Use of eHRPWM in Standby mode

Part Number: AM3352
Other Parts Discussed in Thread: SYSCONFIG

Tool/software: Linux

Hi,

we are planning to create a Linux Embedded Device that uses EHRPWM to generate a PWM output while the AM3352 CPU is in Linux standby mode (not Deepsleep0).

(see )

I  noticed that the PWM subsystem is inside the peripheral power domain

Is it possible to use the PWM outputs while the CPU is in sleep mode and does the linux suspend code possibly support this?

We are still using Processor SDK 1.0 (kernel 3.14.y) but will possibly upgrade to the latest version soon.

Regards,

Bastian Schmitz

  • Hi Bastian,

    This depends on which pins are you planning to use, see Section 8.1.4.3.2 Standby of the device TRM:
    "Wakeup in Standby mode is achieved using any GPIO. GPIO wakeup is possible by switching the pad to GPIO mode and configuring the corresponding GPIO bank for generating an interrupt to the MPUSS. Note that pads that do not have a GPIO muxmode (for example, ADC or USB), cannot cause these wakeups. If additional or other wakeup sources are required, the associated peripheral module clock and interconnect clock domain should remain enabled (this may require the associated PLL to remain locked) and the module must be configured appropriately for wakeup
    by configuring it to generate an interrupt to the MPUSS"

    You can try this by modifying the PWM hwmod from arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c, the relevant structures are:
    /* pwmss */
    static struct omap_hwmod_class_sysconfig am33xx_epwmss_sysc = {

    /* epwmss1 */
    struct omap_hwmod am33xx_epwmss1_hwmod

    /* epwmss2 */
    struct omap_hwmod am33xx_epwmss2_hwmod

    Best Regards,
    Yordan
  • Hi Yordan,

    just to verify you understood my question correctly: The text you quoted is primarily about GPIO wakeup from Standby Mode, but my question was about using the EHRPWM function block while in Standby Mode.

    You suggest to change the quoted data structures in order to keep the clocks enabled and the ehrpwm function block running in Standby Mode?

    Best Regards,

    Bastian Schmitz

  • Hi Bastian,

    Yes, correct. Try adding:
    .flags = HWMOD_IDLEMODE_NO ,

    Best Regards,
    Yordan
  • Hi Yordan,

    I applied this change

    --- a/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
    +++ b/arch/arm/mach-omap2/omap_hwmod_33xx_43xx_ipblock_data.c
    @@ -529,9 +529,7 @@ static struct omap_hwmod_class_sysconfig am33xx_epwmss_sysc = {
            .rev_offs       = 0x0,
            .sysc_offs      = 0x4,
            .sysc_flags     = (SYSC_HAS_SIDLEMODE | SYSC_HAS_MIDLEMODE),
    -       .idlemodes      = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART |
    -                       SIDLE_SMART_WKUP | MSTANDBY_FORCE | MSTANDBY_NO |
    -                       MSTANDBY_SMART | MSTANDBY_SMART_WKUP),
    +       .idlemodes      = (SIDLE_NO | MSTANDBY_NO),
            .sysc_fields    = &omap_hwmod_sysc_type2,
     };

    @@ -563,6 +561,7 @@ struct omap_hwmod am33xx_epwmss0_hwmod = {
                            .modulemode     = MODULEMODE_SWCTRL,
                    },
            },
    +       .flags = HWMOD_SWSUP_SIDLE_ACT | HWMOD_SWSUP_MSTANDBY,
     };

     /* ecap0 */
    @@ -600,6 +599,7 @@ struct omap_hwmod am33xx_epwmss1_hwmod = {
                            .modulemode     = MODULEMODE_SWCTRL,
                    },
            },
    +       .flags = HWMOD_SWSUP_SIDLE_ACT | HWMOD_SWSUP_MSTANDBY,
     };

     /* ecap1 */
    @@ -637,6 +637,7 @@ struct omap_hwmod am33xx_epwmss2_hwmod = {
                            .modulemode     = MODULEMODE_SWCTRL,
                    },
            },
    +       .flags = HWMOD_SWSUP_SIDLE_ACT | HWMOD_SWSUP_MSTANDBY,
     };

     /* ecap2 */

    because of the following code in _enable_sysc which I guess are the flags to set you pointed out in your previous answer.

    static void _enable_sysc(struct omap_hwmod *oh)

    ...

        if (sf & SYSC_HAS_SIDLEMODE) {
            if (oh->flags & HWMOD_SWSUP_SIDLE ||
                oh->flags & HWMOD_SWSUP_SIDLE_ACT) {
                idlemode = HWMOD_IDLEMODE_NO;

    ...

        if (sf & SYSC_HAS_MIDLEMODE) {
            if (oh->flags & HWMOD_FORCE_MSTANDBY) {
                idlemode = HWMOD_IDLEMODE_FORCE;
            } else if (oh->flags & HWMOD_SWSUP_MSTANDBY) {
                idlemode = HWMOD_IDLEMODE_NO;

    Unfortunately the PWM signal still freezes either in high or low state (seems to depend on the duty cycle) when I execute

    rtcwake -m standby -s 5

    and reapperars after wakeup.

    So I guess either the code changes I applied are not executed or I missed a thing or the  PWM unit is disabled because of another reason.

    Btw. I already checked pwm-tipwmss.c and pwm-tiehrpwm.c .suspend and functions if they disable the PWM units somehow.

    Do you have any hints what to check next? Do you think tracing down the point where the PWM signal disappears while going to standby mode is feasible?

    Best regards,

    Bastian

  • Hi Bastian,

    Let me check further.

    Best Regards,
    Yordan
  • Hi Bastian,

    We're looking into this. I've contacted the design team for help, their feedback will be posted directly here.

    Best Regards,
    Yordan
  • Hi Basian,

    Try putting a breakpoint in Linux/arch/arm/mach-omap2/pm33xx.c during suspend (am33xx_pm_suspend would be a good start).

    Next you will need to dig into the PM firmware (repo is here: git.ti.com/.../). Be sure to checkout the proper branch (you'd want ti-v3.14.y for your older kernel).

    The next issue you will need to deal with is the fact we put the CORE PLL into bypass mode during standby to save power. The PWM modules derive their clocks from this PLL. The effect is the PWM modules will receive a clock equal to the crystal frequency. The ds_save function in pm_services/prcm_core.c of the pm firmware is responsible for putting the CORE PLL into bypass during standby.

    Another likely thing to be addressed in the PM firmware is the fact we put the interconnects in standby mode. Because the PWM module would be remaining active, putting the interconnects into standby will fail, which will cause standby to essentially hang because the M3 power management processor never reaches the WFI state.

    Essentially you will need to customize the standby path to accommodate maintaining the PWM signal during standby.

    What are your power goals? Do you require going all the way down to standby, or could selectively disabling key peripherals be good enough?

    Regards,
    Mike
  • Hi Basian,

    Have you been able to make progress on this?

    Regards,
    Mike
  • Hi Mike,
    Your post convinced us to move the functionality to another existing microcontroller on the board. Apart from the risk to solve this in time - nobody wants maintain a changeset like this for the kernel and the m3. Thanks for the detailed description.
  • Bastian,

    Appreciate you taking the time for an update.