Information Center for ARM

Example description

  
PWR_BOR PWR Brown Out Reset (BOR) example
  
Example Description 

This example shows how to configure the programmable BOR thresholds using the 
FLASH option bytes.

By maintaining the Key push-button pressed at Reset, the new BOR level will be 
programmed. To modify the BOR threshold, select the voltage range using the 
appropriate line "#define BOR_LEVEL OB_BOR_XXXX" in main.c file.
 
LED1 is toggling to indicate that the reset is released and the system is in RUN
mode otherwise the BOR is maintaining the reset.

Directory contents 

  - PWR/BOR/stm32f2xx_conf.h    Library Configuration file
  - PWR/BOR/stm32f2xx_it.c      Interrupt handlers
  - PWR/BOR/stm32f2xx_it.h      Interrupt handlers header file
  - PWR/BOR/main.c              Main program
  - PWR/BOR/system_stm32f2xx.c  STM32F2xx system source file
  
	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 

Hardware and Software environment

  - This example runs on STM32F2xx Devices.
  
  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board.

  - STM322xG-EVAL Set-up
    - Use LED1 led connected to PG.06 pin
    - Use the Key push-button connected to pin PG15 (EXTI Line15)

===============================================================================

PWR_CurrentConsumption PWR Current Consumption example
  
Example Description 

This example shows how to configure the STM32F2xx system to measure different
Low Power modes current consumption. The Low Power modes are:
  - Sleep Mode
  - STOP mode with RTC
  - STANDBY mode without RTC and BKPSRAM
  - STANDBY mode with RTC
  - STANDBY mode with RTC and BKPSRAM
  
To run this example, user has to follow the following steps:
 1. Select the Low power modes to be measured by uncommenting the corresponding
    line inside the stm32f2xx_lp_modes.h file.
    @code
       /*#define SLEEP_MODE*/
       /*#define STOP_MODE*/
       /*#define STANDBY_MODE*/
       #define STANDBY_RTC_MODE
       /*#define STANDBY_RTC_BKPSRAM_MODE*/
    @endcode       

 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:

 1. After reset, the program waits for Key button connected to the PG.15 to be 
    pressed to enter the selected low power mode.
     - When the RTC is not used in the 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).

 2. Low power modes description:

    - Sleep Mode
    ============  
            - System Running at PLL (120MHz)
            - Flash 3 wait state
            - Prefetch and Cache enabled
            - Code running from Internal FLASH
            - All peripherals disabled.
            - Wakeup using EXTI Line (Key Button PG.15)

    - STOP Mode
    ===========
            - RTC Clocked by LSE or LSI
            - Regulator in LP mode
            - HSI, HSE OFF and LSI if not used as RTC Clock source
            - No IWDG
            - FLASH in deep power down mode
            - Automatic Wakeup using RTC clocked by LSE/LSI (after ~20s)

    - STANDBY Mode
    ==============
            - Backup SRAM and RTC OFF
            - IWDG and LSI OFF
            - Wakeup using WakeUp Pin (PA.00)
                        
    - STANDBY Mode with RTC clocked by LSE/LSI 
    ==========================================
            - RTC Clocked by LSE or LSI
            - IWDG OFF and LSI OFF  if not used as RTC Clock source
            - Backup SRAM OFF
            - Automatic Wakeup using RTC clocked by LSE/LSI (after ~20s)

    - STANDBY Mode with RTC clocked by LSE/LSI and BKPSRAM
    ======================================================
            - RTC Clocked by LSE or LSI
            - Backup SRAM ON
            - IWDG OFF
            - Automatic Wakeup using RTC clocked by LSE/LSI (after ~20s)

Directory contents 

  - PWR/CurrentConsumption/stm32f2xx_conf.h              Library Configuration file
  - PWR/CurrentConsumption/stm32f2xx_it.c                Interrupt handlers
  - PWR/CurrentConsumption/stm32f2xx_it.h                Interrupt handlers header file
  - PWR/CurrentConsumption/main.c                        Main program
  - PWR/CurrentConsumption/system_stm32f2xx.c            STM32F2xx system source file
  - PWR/CurrentConsumption/stm32f2xx_lp_modes.c          STM32F2xx Low Power Modes source file
  - PWR/CurrentConsumption/stm32f2xx_lp_modes.h          STM32F2xx Low Power Modes header file

	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool.

Hardware and Software environment

  - This example runs on STM32F2xx Devices revision B and revision Y
  
  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board.

  - STM322xG-EVAL Set-up
    - Use LED1 connected  to PG.06 pin.
    - Use Key Button connected to PG.15 pin.
    - Connect an amperemeter to JP32 to measure the IDD current

===============================================================================

PWR_PVD PWR Programmable Voltage Detector (PVD) example
  
Example Description 

This example shows how to configure the programmable voltage detector using
an external interrupt line. In this example, EXTI line 16 is configured to generate 
an interrupt on each rising or falling edge of the PVD output signal (which 
indicates that the Vdd voltage is below the PVD threshold).
In the interrupt routine a led connected to a specific GPIO pin is toggled every 
time the voltage drops below or above the target threshold.

A LED connected to a specific GPIO pin is toggling to indicate that the system 
is in RUN.

Directory contents 

  - PWR/PVD/stm32f2xx_conf.h    Library Configuration file
  - PWR/PVD/stm32f2xx_it.c      Interrupt handlers
  - PWR/PVD/stm32f2xx_it.h      Interrupt handlers header file
  - PWR/PVD/main.c              Main program
  - PWR/PVD/system_stm32f2xx.c  STM32F2xx system source file
  
	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 

@par Hardware and Software environment

  - This example runs on STM32F2xx Devices.
  
  - HW Set-up
    - Connect a LED to PG.06 pin (will be referred to by LED1 in the example code)
    - Connect a LED to PG.08 pin (will be referred to by LED2 in the example code)
    This example can't run on the STM322xG-EVAL board.

===============================================================================

PWR_STANDBY PWR_STANDBY
  
Example Description 

This example shows how to enters the system to STANDBY mode and wake-up from this
mode using: external RESET, RTC Alarm A or WKUP pin.

In the associated software, the system clock is set to 120 MHz, an EXTI line
is configured to generate an interrupt on falling edge and the SysTick is programmed
to generate an interrupt each 250 ms. In the SysTick interrupt handler, the LED1 is
toggled, this is used to indicate whether the MCU is in STANDBY or RUN mode.

When a falling edge is detected on the EXTI line an interrupt is generated. In the 
EXTI handler routine the RTC is configured to generate an Alarm event in 5 second
then the system enters STANDBY mode causing the LED1 to stop toggling. 
A rising edge on WKUP pin or an external RESET will wake-up the system from
STANDBY. If within 5 second neither rising edge on WKUP pin nor external RESET
are generated, the RTC Alarm A will wake-up the system. 

After wake-up from STANDBY mode, program execution restarts in the same way as after
a RESET, the RTC configuration (clock source, prescaler,...) is kept and LED1 restarts
toggling. As result there is no need to configure the RTC.

two leds LED1 and LED2 are used to monitor the system state as following:
 - LED2 ON: RTC configuration failed (system will go to an infinite loop)
 - LED1 toggling: system in RUN mode
 - LED1 off : system in STANDBY mode

These Steps are repeated in an infinite loop.

	 To measure the current consumption in STANDBY mode, please refer to 
     PWR_CurrentConsumption example.

Directory contents 

  - PWR/STANDBY/system_stm32f2xx.c   STM32F2xx system clock configuration file
  - PWR/STANDBY/stm32f2xx_conf.h     Library Configuration file
  - PWR/STANDBY/stm32f2xx_it.c       Interrupt handlers
  - PWR/STANDBY/stm32f2xx_it.h       Header for stm32f2xx_it.c
  - PWR/STANDBY/main.c               Main program

  
	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool. 

Hardware and Software environment 

  - This example runs on STM32F2xx Devices.
  
  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board.

  - STM322xG-EVAL Set-up
    - Use LED1 and LED2 connected to PG.06 and PG.08 pins
    - Use the Key push-button connected to pin PG15 (EXTI Line15)

===============================================================================

PWR_STOP PWR_STOP
  
Example Description 

This example shows how to enters the system to STOP mode and wake-up from this
mode using RTC Wakeup Timer Event connected to EXTI Line 22.

In the associated software
  - the system clock is set to 120 MHz
  - the EXTI_Line15 is configured to generate interrupt on falling edge
  - the EXTI_Line22 connected internally to the RTC Wakeup event is configured
    to generate an interrupt on rising edge each 4s
  - the SysTick is programmed to generate an interrupt each 250 ms 
In the SysTick interrupt handler, LED2 is toggled, this is used to indicate whether
the MCU is in STOP or RUN mode.

The system enters STOP mode and will wait for the RTC Wakeup event to be 
generated each 4s, or Key push button is pressed. 
 - If the RTC WakeUp event (EXTI_Line22) is the source of wakeup from STOP, LED1 is toggled.
 - If the Key button (EXTI_Line15) is the source of wakeup from STOP, LED4 is toggled.

This behavior is repeated in an infinite loop.

LEDs are used to monitor the system state as following:
 - LED2 toggling: system in RUN mode
 - LED1 toggled: system woken up from STOP using RTC WakeUp Interrupt
 - LED4 toggled: system woken up from STOP using EXTI_Line15 (KEY push button)
 
	To measure the current consumption in STOP mode, please refer to 
    PWR_CurrentConsumption example.

Directory contents 

  - PWR/STOP/system_stm32f2xx.c   STM32F2xx system clock configuration file
  - PWR/STOP/stm32f2xx_conf.h     Library Configuration file
  - PWR/STOP/stm32f2xx_it.c       Interrupt handlers
  - PWR/STOP/stm32f2xx_it.h       Header for stm32f2xx_it.c
  - PWR/STOP/main.c               Main program
  
	  The "system_stm32f2xx.c" is generated by an automatic clock configuration 
      tool and can be easily customized to your own configuration. 
      To select different clock setup, use the "STM32F2xx_Clock_Configuration_V1.0.0.xls" tool.

Hardware and Software environment 

  - This example runs on STM32F2xx Devices.
  
  - This example has been tested with STM322xG-EVAL RevB and can be easily tailored
    to any other development board. 

  - STM322xG-EVAL Set-up
    - Use LED1, LED2 and LED4 connected respectively to PG.06, PG.08 and PC.07 pins
    - Use the Key push-button connected to pin PG15 (EXTI_Line15)