Keil Logo

Power Reduction Modes

Cortex-M devices implement various mechanisms to reduce power consumption. One of the techniques is to switch off or even disable the clock for every peripheral. By disabling the clock, the complete peripheral is disabled.

Cortex-M cores have two sleep modes SLEEP and DEEP SLEEP. The SLEEPDEEP-bit selects the sleep mode. The following instructions handle the low power mode entry:

  • WFE: Wait for Event
  • WFI: Wait for Interrupt

Whether the SLEEP or DEEP SLEEP mode is used depends on the implementation of the Cortex-M microcontroller.

#include <stm32f10x_lib.h>              // STM32F10x Library Definitions
#include "STM32_Init.h"                 // STM32 Initialization

unsigned int ledPosExti = 0;            // led position (from 0..7) for EXTI
unsigned int ledExti    = 0;

void Sleep (void) {
   __wfi();
}

/*---------------------------------------------------------------------------------
  EXTI15..10 Interrupt Handler
 *---------------------------------------------------------------------------------*/
void EXTI15_10_IRQHandler(void)
{
   //wakes up from power down
}


/*---------------------------------------------------------------------------------
  MAIN function
 *---------------------------------------------------------------------------------*/
int main (void) {

   stm32_Init ();                        // STM32 setup
   Sleep();                              // Call the wfi() - wait for interrupt

   while (1);                            // Loop forever
}
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.