1.. _stm32-pm-blinky-sample:
2
3STM32 PM Blinky
4###############
5
6Overview
7********
8
9This sample is a minimum application to demonstrate basic power management
10behavior in a basic blinking LED set up using the :ref:`GPIO API <gpio_api>` in
11low power context.
12Note that lptim instance selected for the low power timer is named **&stm32_lp_tick_source**
13When setting a prescaler to decrease the lptimer input clock frequency, the system can sleep
14for a longer  timeout value and the CONFIG_SYS_CLOCK_TICKS_PER_SEC is adjusted.
15For example, when clocking the  low power Timer with LSE clock at 32768Hz and adding a
16prescaler of <32>, then the kernel sleep period can reach 65536 * 32/32768 = 64 seconds
17CONFIG_SYS_CLOCK_TICKS_PER_SEC is set to 1024.
18
19.. _stm32-pm-blinky-sample-requirements:
20
21Requirements
22************
23
24The board should support enabling PM. For a STM32 based target, it means that
25it should support a clock source alternative to Cortex Systick that can be used
26in core sleep states, as LPTIM (:dtcompatible:`st,stm32-lptim`).
27
28Building and Running
29********************
30
31Build and flash Blinky as follows, changing ``stm32l562e_dk`` for your board:
32
33.. zephyr-app-commands::
34   :zephyr-app: samples/basic/blinky
35   :board: stm32l562e_dk
36   :goals: build flash
37   :compact:
38
39After flashing, the LED starts to blink with a fixed period (SLEEP_TIME_MS).
40When LPTIM input clock has a prescaler, longer perdiod (up to 64 seconds)
41of low power can be tested.
42
43
44PM configurations
45*****************
46
47By default, :kconfig:option:`CONFIG_PM_DEVICE` and :kconfig:option:`CONFIG_PM_DEVICE_RUNTIME` are
48enabled, but user can also deactivate one or the other to see each configuration
49in play.
50