samples: boards: stm32 low power blinky for stm32 boards
Set the prescaler for the stm32_lp_tick_source lptim node. When the LPTIM is clocked by the LSE with a prescaler of 16 (lptim freq at 2048Hz) expecting 2048 for the TICKS_PER_SEC. When the LPTIM is clocked by the LSE with a prescaler of 32 (lptim freq at 1024Hz) expecting 1024 for the TICKS_PER_SEC. Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
302aae2749
commit
bf2b4675d0
4 changed files with 23 additions and 4 deletions
|
@ -9,6 +9,12 @@ Overview
|
|||
This sample is a minimum application to demonstrate basic power management
|
||||
behavior in a basic blinking LED set up using the :ref:`GPIO API <gpio_api>` in
|
||||
low power context.
|
||||
Note that lptim instance selected for the low power timer is named **&stm32_lp_tick_source**
|
||||
When setting a prescaler to decrease the lptimer input clock frequency, the system can sleep
|
||||
for a longer timeout value and the CONFIG_SYS_CLOCK_TICKS_PER_SEC is adjusted.
|
||||
For example, when clocking the low power Timer with LSE clock at 32768Hz and adding a
|
||||
prescaler of <32>, then the kernel sleep period can reach 65536 * 32/32768 = 64 seconds
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC is set to 1024.
|
||||
|
||||
.. _stm32-pm-blinky-sample-requirements:
|
||||
|
||||
|
@ -30,7 +36,10 @@ Build and flash Blinky as follows, changing ``stm32l562e_dk`` for your board:
|
|||
:goals: build flash
|
||||
:compact:
|
||||
|
||||
After flashing, the LED starts to blink.
|
||||
After flashing, the LED starts to blink with a fixed period (SLEEP_TIME_MS).
|
||||
When LPTIM input clock has a prescaler, longer perdiod (up to 64 seconds)
|
||||
of low power can be tested.
|
||||
|
||||
|
||||
PM configurations
|
||||
*****************
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
/*
|
||||
* give a prescaler to the lptim clock : LSE / 16 = 2048Hz
|
||||
* so that the sleep period is of 32s in the sample application
|
||||
* with a LPTIM1 prescaler of <1> to <8>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is 4096
|
||||
* with a LPTIM1 prescaler >= <16>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is LSE / prescaler
|
||||
*/
|
||||
&stm32_lp_tick_source {
|
||||
st,prescaler = <16>;
|
||||
};
|
|
@ -1,9 +1,9 @@
|
|||
/*
|
||||
* give a prescaler to the lptim clock : LSE / 32 = 1024Hz
|
||||
* so that the sleep period is of 64s in the sample application
|
||||
*
|
||||
* with a LPTIM1 prescaler of <1> to <8>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is 4096
|
||||
* with a LPTIM1 prescaler >= <16>, CONFIG_SYS_CLOCK_TICKS_PER_SEC is LSE / prescaler
|
||||
*/
|
||||
|
||||
&lptim1 {
|
||||
&stm32_lp_tick_source {
|
||||
st,prescaler = <32>;
|
||||
};
|
||||
|
|
|
@ -2,3 +2,4 @@ CONFIG_PM=y
|
|||
CONFIG_PM_DEVICE=y
|
||||
CONFIG_PM_DEVICE_RUNTIME=y
|
||||
CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE=n
|
||||
CONFIG_ASSERT=y
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue