What does STM32 sleep mode do to the CPU?

What does STM32 sleep mode do to the CPU?

STM32 Sleep Mode: Interrupt gets executed but the CPU stays in WFI. Which means, that calling any interrupt regardless of its priority would wake up the processor, since the WFI was called from the main. For information, all the implemented interrupt priorities are set to 0 except for the EXTI, which is set to -1. Now this is what actually happens.

What happens when the reset state of STM32 is reached?

At the reset state, all interrupts are disabled. The processor begins executing the code instructions with a base execution priority lower than the lowest programmable priority level, so any enabled interrupt can pre-empt the processor. When an enabled interrupt is asserted, the interrupt is serviced by the corresponding ISR handler.

How to do STM32 interrupts external interrupts tutorial?

STM32 Interrupts Tutorial | NVIC & EXTI. 1 1. ARM® v7 Cortex™ Exceptions / Interrupts. 2 2. Interrupts Tail-Chaining SpeedUp. 3 3. Interrupt Late Arrival SpeedUp. 4 4. Pre-Emption. 5 5. Interrupt Vector Table.

How to disable the interrupt nesting in STM32?

The interrupt nesting is always enabled, to disable it just set all the interrupts to the same priority level. When an exception occurs, the current instruction stream is stopped and the processor accesses the exceptions vector table.

When to enter sleep when returning to handler mode?

Configures sleep-on-exit when returning from Handler mode to Thread mode. Setting this bit to 1 enables an interrupt-driven application to avoid returning to an empty main application. 0: Do not sleep when returning to Thread mode. 1: Enter sleep, or deep sleep, on return from an interrupt service routine.

Do you sleep when returning to thread mode?

0: Do not sleep when returning to Thread mode. 1: Enter sleep, or deep sleep, on return from an interrupt service routine. Thanks for contributing an answer to Electrical Engineering Stack Exchange!

How to tell if a microcontroller is in sleep mode?

Then it waits for the external interrupt to wake it up, execute the interrupt and continue with the main program. In the ISR I toggle an LED on pin PA0 every time the routine is called, but then use pin PA1 in the main () that toggles and LED on and off with a short delay, indicating that the microcontroller exited the sleep mode.

When does the CPU go into sleep mode?

I started with a simple program that puts the CPU into sleep mode at the beginning of the execution. Then it waits for the external interrupt to wake it up, execute the interrupt and continue with the main program.

What does the second line mean in WFI wakeup event?

An IMPLEMENTATION DEFINED WFI wakeup event. If my understanding is correct, the second line applies in this case. Which means, that calling any interrupt regardless of its priority would wake up the processor, since the WFI was called from the main.