/**
@page PWR_CurrentConsumption PWR Current Consumption example
@verbatim
******************** (C) COPYRIGHT 2015 STMicroelectronics *******************
* @file PWR/CurrentConsumption/readme.txt
* @author MCD Application Team
* @version V1.2.1
* @date 20-April-2015
* @brief Description of the PWR Current Consumption example.
******************************************************************************
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
@endverbatim
@par Example Description
This example shows how to configure the STM32L1xx system to measure different
Ultra Low Power modes current consumption. The Ultra Low Power modes are:
- Low Power Run Mode from Internal SRAM
- Low Power Run Mode from Internal FLASH
- Sleep Mode
- Low Power Sleep Mode
- STOP mode with or without RTC
- STANDBY mode with or without RTC
To run this example, user has to follow the following steps:
1. Select the Ultra Low power modes to be measured by uncommenting the corresponding
line inside the stm32l1xx_ulp_modes.h file.
#define LP_RUN_SRAM_MODE
#define LP_RUN_FLASH_MODE
#define SLEEP_MODE
#define LP_SLEEP_MODE
#define STOP_MODE
#define STOP_RTC_LSE_MODE
#define STOP_RTC_LSI_MODE
#define STANDBY_MODE
#define STANDBY_RTC_LSE_MODE
#define STANDBY_RTC_LSI_MODE
2. Use an external amperemeter to measure the IDD current.
3. This example can not be used in DEBUG mode as the JTAG IOs are disabled to
reduce power consumption.
Here below a detailed description of the example code:
@verbatim
1. First, the code checks if the BOR is disabled or not. If the BOR is ON, the
code writes to Option Bytes and launch and Option byte loading phase generating
a system reset.
2. After reset, the program waits for Key button connected to the PA.00 to be
pressed to enter the selected ultra low power mode.
- When the RTC is not used in the ultra low power mode configuration, press
again the Key button to exit the low power mode.
- When the RTC is used, the wakeup from low power mode is automatically
generated by the RTC (after 4s).
3. Ultra Low power modes description:
- Low Power Run mode
====================
The maximum clock when the system is in Low Power Run mode is ~128KHz.
This mode can only be entered when Voltage Range 2 is selected.
Low Power Run Mode from SRAM:
-----------------------------
- System Running at MSI (~32KHz)
- Flash 0 wait state
- Voltage Range 2
- Regulator in LP mode
- Code running from Internal SRAM
- All peripherals OFF
- FLASH switched OFF
- VDD from 1.65V to 3.6V
- Current Consumption ~10.5uA
- Wakeup using Key Button PA.00
Low Power Run Mode from FLASH:
------------------------------
- System Running at MSI (~32KHz)
- Flash 0 wait state
- Voltage Range 2
- Regulator in LP mode
- Code running from Internal FLASH
- All peripherals OFF
- VDD from 1.65V to 3.6V
- Current Consumption ~25uA
- Wakeup using Key Button PA.00
- Sleep Mode
============
- System Running at HSI (16MHz)
- Flash 1 wait state
- Voltage Range 2
- Code running from Internal FLASH
- Current Consumption ~1mA
- Wakeup using EXTI Line (Key Button PA.00)
- Low Power Sleep Mode
======================
The maximum clock when the system is in Low Power Run mode is ~128KHz.
This mode can only be entered when Voltage Range 2 is selected.
- System Running at MSI (~32KHz)
- Flash 0 wait state
- Voltage Range 2
- Regulator in LP mode
- Code running from Internal FLASH
- All peripherals OFF
- FLASH in Power Down mode
- VREFINT OFF
- VDD from 1.65V to 3.6V
- Current Consumption ~4.07uA
- Wakeup using EXTI Line (Key Button PA.00)
- STOP Mode
===========
- Regulator in LP mode
- VREFINT OFF
- LSI, HSI and HSE OFF
- No IWDG
- Current Consumption ~0.5uA
- Wakeup using EXTI Line (Key Button PA.00)
- STOP Mode with RTC clocked by LSE
===================================
- RTC Clocked by LSE external Clock (32.768KHz)
- Regulator in LP mode
- VREFINT OFF
- LSI, HSI and HSE OFF
- No IWDG
- Current Consumption ~1.6uA
- Automatic Wakeup using RTC on LSE (after 4s)
- STOP Mode with RTC clocked by LSI
===================================
- RTC Clocked by LSI
- Regulator in LP mode
- VREFINT OFF
- HSI and HSE OFF
- No IWDG
- Current Consumption ~1.3uA
- Automatic Wakeup using RTC on LSI (after ~4s)
- STANDBY Mode
==============
- IWDG and LSI OFF
- VREFINT OFF
- Current Consumption ~0.3uA
- Wakeup using WakeUp Pin 1 (PA.00)
- STANDBY Mode with RTC clocked by LSE
======================================
- RTC Clocked by LSE external Clock (32.768KHz)
- IWDG and LSI OFF
- VREFINT OFF
- Current Consumption ~1.3uA
- Automatic Wakeup using RTC on LSE (after 4s)
- STANDBY Mode with RTC clocked by LSI
======================================
- RTC Clocked by LSI
- IWDG OFF
- VREFINT OFF
- Current Consumption ~1.1uA
- Automatic Wakeup using RTC on LSI (after ~4s)
4. After reset the system clock frequency is configured to MSI Range 1 (~131KHz)
and Voltage range 2 and then according to each ultra low power mode the system
frequency is reconfigured again.
@endverbatim
@note The STM32L152-EVAL board contains an automatic IDD measurement circuit using
internal ADC. The associated software allowing the automatic IDD measurement
is provided with STM32L152-EVAL board demonstration firmware.
For more details, refer to UM1009 available on <a href="http://www.st.com/internet/mcu/family/141.jsp"> ST Microcontrollers </a>
@par Directory contents
- PWR/CurrentConsumption/stm32l1xx_conf.h Library Configuration file
- PWR/CurrentConsumption/stm32l1xx_it.c Interrupt handlers
- PWR/CurrentConsumption/stm32l1xx_it.h Interrupt handlers header file
- PWR/CurrentConsumption/main.c