Skip to main content
Ashley Duncan
Associate II
May 11, 2017
Solved

How to disable stop mode wakeup sources?

  • May 11, 2017
  • 4 replies
  • 1951 views
Posted on May 11, 2017 at 04:59

Hi,

Is there any way to prevent some interrupt sources waking up when in stop mode except the one I want?  I may not know what interrupts are enabled/disabled when entering stop mode (obviously I could check the registers).

I want to delay in stop mode using the RTC wakeup timer but don't want other interrupt sources (eg EXTI) waking up during this delay otherwise it may cut my delay short!

Can this be done using interrupt priorites or are they not considered for wakeup?

Using STM32L051

Any ideas?

    This topic has been closed for replies.
    Best answer by Max
    Posted on May 11, 2017 at 07:09

    The only way is to disable those sources before entering STOP and restore them after wake-up.

    Save your EXTI registers and restore them after wake-up....

    4 replies

    Max
    MaxBest answer
    ST Employee
    May 11, 2017
    Posted on May 11, 2017 at 07:09

    The only way is to disable those sources before entering STOP and restore them after wake-up.

    Save your EXTI registers and restore them after wake-up....

    Ashley Duncan
    Associate II
    May 11, 2017
    Posted on May 11, 2017 at 22:37

    Thanks.  I was thinking that would probably be the case but was hoping there may be another solution.  I think I can work with that though...

    Although, that would only prevent wakeup from external sources.  Presumably it could still wake up from enabled internal interrupt sources?

    Max
    ST Employee
    May 12, 2017
    Posted on May 12, 2017 at 10:37

    All wake-up sources are connected to internal EXTI.

    So playing with EXTI register should allow to disable all of them (including the RTC...)

    Ashley Duncan
    Associate II
    May 14, 2017
    Posted on May 14, 2017 at 22:45

    I used this:

    uint32_t tempEXTIIMR = 0;

    if(disableOtherWakeupSources)

    {

    // Remember the state of all wake up sources

    tempEXTIIMR = EXTI->IMR;

    // Disable all but RTC wake up source

    EXTI->IMR = EXTI_IMR_IM20;

    }

    // Go into stop mode pending RTC wakeup timer...

    if(disableOtherWakeupSources)

    {

    // Restore original wake up sources

    EXTI->IMR = tempEXTIIMR;

    }