2017-05-10 07:59 PM
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?
Solved! Go to Solution.
2017-05-10 10:09 PM
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....
2017-05-10 10:09 PM
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....
2017-05-11 01:37 PM
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?
2017-05-12 03:37 AM
All wake-up sources are connected to internal EXTI.
So playing with EXTI register should allow to disable all of them (including the RTC...)
2017-05-14 01:45 PM
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; }