Commit 3dabe035 authored by Adam Berlinger's avatar Adam Berlinger Committed by Anas Nashif
Browse files

samples: boards: stm32: Add example for STOP3 mode on STM32U5



Simple blinky example, but using STOP3 mode. When in STOP3 mode,
GPIOs are not driven, but only pull-up or pull-down can be enabled
based on value in PWR registers.

Signed-off-by: default avatarAdam Berlinger <adam.berlinger@st.com>
parent 19b39406
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -199,3 +199,13 @@ zephyr_udc0: &usbotg_fs {
&vbat4 {
	status = "okay";
};

&clk_lsi {
	status = "okay";
};

stm32_lp_tick_source: &lptim1 {
	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00000800>,
		 <&rcc STM32_SRC_LSI LPTIM1_SEL(1)>;
	status = "okay";
};
+7 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(stm32_pm_stop3)

target_sources(app PRIVATE src/main.c)
+38 −0
Original line number Diff line number Diff line
.. _stm32-pm-stop3:

STM32 PM STOP3 mode
###################

Overview
********

This sample is a minimum application to demonstrate basic power management
behavior in a basic blinking LED set up and STM32U5 STOP3 low power mode.

.. _stm32-pm-stop3-requirements:

Requirements
************

At the moment, only ``nucleo_u575zi_q`` board is supported.
The board shall have an RTC to use it during the standby mode as a replacement
for LPTIM (which is disabled).

Building and Running
********************

Build and flash examples as follows:

.. zephyr-app-commands::
   :zephyr-app: samples/boards/stm32/power_mgmt/stop3
   :board: nucleo_u575zi_q
   :goals: build flash
   :compact:

After flashing, the LED starts to blink.

PM configurations
*****************

By default, :kconfig:option:`CONFIG_PM_DEVICE` and :kconfig:option:`CONFIG_PM_DEVICE_RUNTIME`
are enabled.
+22 −0
Original line number Diff line number Diff line
/*
 * SPDX-License-Identifier: Apache-2.0
 *
 * Copyright (c) 2024 STMicroelectronics
 */

/ {
	chosen {
		st,lptim-stdby-timer = &rtc;
	};
};

&cpu0 {
	cpu-power-states = <&stop0 &stop1 &stop2 &stop3>;
};

&rtc {
	status = "okay";
	clocks = <&rcc STM32_CLOCK_BUS_APB3 0x00200000>,
			<&rcc STM32_SRC_LSI RTC_SEL(2)>;
	prescaler = <32768>;
};
+5 −0
Original line number Diff line number Diff line
CONFIG_PM=y
CONFIG_PM_DEVICE=y
CONFIG_PM_DEVICE_RUNTIME=y
CONFIG_PM_DEVICE_RUNTIME_EXCLUSIVE=n
CONFIG_ASSERT=y
Loading