 Hello, in this section we are going to look at the STM32L0 low power modes. First, let us look at what ARM provide for us in the Cortex-M core. All Cortex-M cores have two low power modes, sleep and deep sleep. Sleep mode has the fastest wake-up time, as only the clock to the core itself has been shut down. If power consumption is more important than wake-up time, then deep sleep will be a more suitable power mode. There are three different ways to access these power saving modes. You can either sleep now by using specific instructions, or you can sleep on exit by configuring the system. Sleep now does exactly what it says. If you reach either of the specific instructions in the code, the device enters the configured sleep mode. The exit method for each instruction is different. Wait for interrupt will execute the interrupt code associated with the peripheral interrupt that has woken the device. Wait for event will continue with the next instruction in the code. This removes potentially unwanted CPU cycles for context saving and restoring. Sleep on exit provides the same benefit as the wait for event instruction by removing unwanted CPU cycles. This method is useful when all control of the system is driven by external interrupts or events. Before we can look at the low power modes of the STM32L0, we need first to understand how all the elements of the device are clocks. The clock controller is the gearbox of the entire system. We have the low speed path driving peripherals that run whilst the CPU core is asleep. We have the medium speed path where current consumption is more important than performance. And finally, a high speed path for when you need the full performance of the device. Each of the different clock sources to the clock controller can provide benefits to the end application. But trade-offs will always have to be made between cost, current consumption, precision and start-up time. The clock system is dynamic, so within the software you can switch between the various clock sources and profiles to build the best power profile versus performance for your application. Beyond the clock controller are the peripheral clocks. Each peripheral has its own dedicated clock system dependent on the complexity of the peripheral and the speed the peripheral is running. By default, all peripheral clocks are off to provide the lowest power profile at start-up. We also need to understand the power supply system to the core before we can look at the low power modes. The internal voltage regulator has three different modes highlighted on the screen, depending on the sequence of the settings of the control bit for the regulator and the executing of the low power entry commands would depend on which low power mode you enter. Dynamic voltage scaling is a method to optimize the power consumption versus performance. The voltage range to the core can be changed by software to optimize the power profile of the end application. This will vary the maximum operating frequency and power consumption per megahertz of the device, but will also give you the ability to run the device at different frequencies with zero weight states. The voltage that is supplied to the device also governs the maximum voltage supplied to the core. Certain peripherals like the ADC and USB also rely on the supply voltage of the device to be above specific values to function and or to function at full speed. Now we have all the information to look at the low power modes of the STM32L0 family. The STM32L0 has five operating modes. Each of the five modes has some flexibility as to what can be enabled or disabled. Room mode is the most flexible mode where everything can be enabled if desired. Each peripheral can be on or off depending on the needs of the application and code can be executed from either flash or RAM as required. Low power run mode is just like run mode in the respect that everything can be enabled or disabled. The difference is the regulator is in low power mode, reducing the maximum speed the device can run at and limiting the output current of the device. Both run mode and low power run mode have their respective sleep modes. Sleep mode sends the core to sleep and automatically any peripherals that have previously been configured, leaving only the required peripherals active. As the core is asleep, instructions are not required so the flash can also be down powered along with the VREF. As we explained earlier, sleep mode is controlled by two instructions, to sleep now or by configuration to sleep on exit. Exit from sleep mode is via one of the running peripherals or the reset circuit. Stop mode, like sleep mode, sends the core to sleep but as the name suggests the main clock tree is now stopped and the regulator is in low power mode. Only peripherals with dedicated clock options can be used in this mode. The SRAM, all the registers and GPIO configurations are maintained in stop mode. Entry into stop mode is controlled by the same two instructions as sleep mode, but this time with the deep sleep option enabled in the cortex core. Exit from stop mode is via any external event connected to the GBI opens, the comparators, the USB or the RTC if enabled. The wake up time from stop mode is a predefined sequence of 8.5 microseconds plus 22 CPU cycles. Most parts require other parts of the system to have started first, but this can be shortened as shown and is called sleep mode. Finally we have standby mode. This is the lowest power mode as it shuts down the core, all the peripherals and the SRAM. The only peripherals that can be left running are the RTC and the independent watchdog if enabled beforehand. Just like sleep and stop, entry is controlled by the same two instructions, but this time with the deep sleep and power down options enabled within the cortex core. Exit from standby mode is via the dedicated wake up pins, the RTC or the independent watchdog if enabled. As the SRAM has been down powered, the code will restart execution from the very beginning. The reset pin can also wake the device from any of the low power modes that have previously been mentioned. Here are the typical current consumptions for all the modes we have just discussed. The values at the top section of each battery are for the maximum temperature range of the device. The extra two values in the stop mode battery are showing the current consumption with the RTC running and with the RTC and low power timer running. Debugging an application that enters low power modes is essential but can always be troublesome. In the STM32L0 we have some dedicated control registers to keep the clock running so the debug communications are maintained in each of the low power modes. You must always remember not to do your current consumption measurements until you have reset this dedicated register. Thank you for listening to this section.