Power control (PWR)
6.3.3
Sleep mode
Entering Sleep mode
The Sleep mode is entered by executing the WFI (Wait For Interrupt) or WFE (Wait for
Event) instructions. Two options are available to select the Sleep mode entry mechanism,
depending on the SLEEPONEXIT bit in the Arm
•
Sleep-now: if the SLEEPONEXIT bit is cleared, the MCU enters Sleep mode as soon
as the WFI or WFE instruction is executed.
•
Sleep-on-exit: if the SLEEPONEXIT bit is set, the MCU enters Sleep mode as soon as
it exits the lowest priority ISR.
In the Sleep mode, all I/O pins keep the same state as in the Run mode.
Refer to
Exiting Sleep mode
If the WFI instruction is used to enter Sleep mode, any peripheral interrupt acknowledged by
the nested vectored interrupt controller (NVIC) can wake up the device from Sleep mode.
If the WFE instruction is used to enter Sleep mode, the MCU exits Sleep mode as soon as
an event occurs. The wake-up event can be generated either by:
•
enabling an interrupt in the peripheral control register but not in the NVIC, and enabling
the SEVONPEND bit in the Cortex-M4 System Control register. When the MCU
resumes from WFE, the peripheral interrupt pending bit and the peripheral NVIC IRQ
channel pending bit (in the NVIC interrupt clear pending register) have to be cleared.
•
or configuring an external or internal EXTI line in event mode. When the CPU resumes
from WFE, it is not necessary to clear the peripheral interrupt pending bit or the NVIC
IRQ channel pending bit as the pending bit corresponding to the event line is not set.
This mode offers the lowest wake-up time as no time is wasted in interrupt entry/exit.
Refer to
Sleep-now mode
Mode entry
Mode exit
Wakeup latency
82/874
Table 14
and
Table 15
Table 14
and
Table 15
WFI (Wait for Interrupt) or WFE (Wait for Event) while:
– SLEEPDEEP = 0 and
– SLEEPONEXIT = 0
Refer to the Cortex-M4 System Control register.
If WFI was used for entry:
Interrupt: Refer to
If WFE was used for entry
Wakeup event: Refer to
None
®
Cortex
for details on how to enter Sleep mode.
for more details on how to exit Sleep mode.
Table 14. Sleep-now
Description
Table 28: STM32F3xx vector table
Section 11.2.3: Wake-up event management
RM0366 Rev 5
®
-M4 System Control register:
RM0366
Need help?
Do you have a question about the STM32F301 6 Series and is the answer not in the manual?