Skip to content

Commit 87c575c

Browse files
committed
samples: boards/nxp: Enable generic poweroff for NXP MCUs
This commit introduced the following changes: 1. Enabled generic poweroff example for NXP MCUs. The example is test on frdm_mcxa153, frdm_mcxa156, frdm_mcxa166, frdm_mcxa276, frdm_mcxn236, frdm_mcxn947 and mimxrt595_evk. 3. Migrate the existing mimxrt595_evk/system_off example to the new poweroff example. 4. The Poweroff example now supports counter wake-up and button/GPIO wake-up, suitable for most NXP devices/boards. For testing purposes, frdm_mcxn236 is wakeup using the wake-up button; frdm_mcxa153, frdm_mcxa156, frdm_mcxa166, frdm_mcxa276, and frdm_mcxn947 are wakeup using lptmr; mimxrt595_evk is wakeup using high-resolution RTC. Signed-off-by: Zhaoxiang Jin <[email protected]>
1 parent 1a1cb1a commit 87c575c

19 files changed

+429
-228
lines changed

samples/boards/nxp/mimxrt595_evk/system_off/Kconfig

Lines changed: 0 additions & 7 deletions
This file was deleted.

samples/boards/nxp/mimxrt595_evk/system_off/README.rst

Lines changed: 0 additions & 142 deletions
This file was deleted.

samples/boards/nxp/mimxrt595_evk/system_off/app.overlay

Lines changed: 0 additions & 10 deletions
This file was deleted.

samples/boards/nxp/mimxrt595_evk/system_off/prj.conf

Lines changed: 0 additions & 9 deletions
This file was deleted.

samples/boards/nxp/mimxrt595_evk/system_off/sample.yaml

Lines changed: 0 additions & 13 deletions
This file was deleted.

samples/boards/nxp/mimxrt595_evk/system_off/src/main.c

Lines changed: 0 additions & 44 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# Copyright 2022, NXP
2-
#
1+
# Copyright 2025 NXP
32
# SPDX-License-Identifier: Apache-2.0
43

54
cmake_minimum_required(VERSION 3.20.0)
65
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
7-
project(mimxrt595_evk_system_off)
6+
project(nxp_mcu_poweroff)
87

98
target_sources(app PRIVATE src/main.c)

samples/boards/nxp/poweroff/Kconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2025 NXP
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
mainmenu "NXP MCU POWER OFF DEMO"
5+
6+
config COUNTER_WAKEUP_ENABLE
7+
bool
8+
select COUNTER
9+
default y if BOARD_FRDM_MCXA153 || BOARD_FRDM_MCXA156 || \
10+
BOARD_FRDM_MCXA166 || BOARD_FRDM_MCXA276 || \
11+
BOARD_FRDM_MCXN947 || BOARD_MIMXRT595_EVK
12+
help
13+
Use counter to wake up device from poweroff.
14+
15+
config GPIO_WAKEUP_ENABLE
16+
bool
17+
select GPIO
18+
default y if BOARD_FRDM_MCXN236
19+
help
20+
Use gpio to wake up device from poweroff.
21+
22+
source "Kconfig.zephyr"
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
.. zephyr:code-sample:: nxp_mcu_poweroff
2+
:name: NXP MCU Poweroff
3+
:relevant-api: sys_poweroff
4+
5+
Use poweroff on NXP MCUs.
6+
7+
Overview
8+
********
9+
10+
This example shows how to poweroff an NXP MCU. In this example,
11+
the wakeup source can be the MCU internal counter or the wakeup
12+
button/gpio. If the counter is used, the MCU will wake up after
13+
5 seconds. If the wakeup button is used, the MCU will wake up
14+
after the wakeup button is pressed.
15+
16+
Building, Flashing and Running
17+
******************************
18+
19+
Building and Running for NXP FRDM-MCXA153
20+
=========================================
21+
Build the application for the :zephyr:board:`frdm_mcxa153` board.
22+
Note: After wakeup, the chip goes through the entire reset process.
23+
24+
.. zephyr-app-commands::
25+
:zephyr-app: samples/boards/nxp/poweroff
26+
:board: frdm_mcxa153
27+
:goals: build flash
28+
:compact:
29+
30+
Building and Running for NXP FRDM-MCXA156
31+
=========================================
32+
Build the application for the :zephyr:board:`frdm_mcxa156` board.
33+
Note: After wakeup, the chip goes through the entire reset process.
34+
35+
.. zephyr-app-commands::
36+
:zephyr-app: samples/boards/nxp/poweroff
37+
:board: frdm_mcxa156
38+
:goals: build flash
39+
:compact:
40+
41+
Building and Running for NXP FRDM-MCXA166
42+
=========================================
43+
Build the application for the :zephyr:board:`frdm_mcxa166` board.
44+
Note: After wakeup, the chip goes through the entire reset process.
45+
46+
.. zephyr-app-commands::
47+
:zephyr-app: samples/boards/nxp/poweroff
48+
:board: frdm_mcxa166
49+
:goals: build flash
50+
:compact:
51+
52+
Building and Running for NXP FRDM-MCXA276
53+
=========================================
54+
Build the application for the :zephyr:board:`frdm_mcxa276` board.
55+
Note: After wakeup, the chip goes through the entire reset process.
56+
57+
.. zephyr-app-commands::
58+
:zephyr-app: samples/boards/nxp/poweroff
59+
:board: frdm_mcxa276
60+
:goals: build flash
61+
:compact:
62+
63+
Building and Running for NXP FRDM-MCXN236
64+
=========================================
65+
Build the application for the :zephyr:board:`frdm_mcxn236` board.
66+
Note: After wakeup, the chip goes through the entire reset process.
67+
68+
.. zephyr-app-commands::
69+
:zephyr-app: samples/boards/nxp/poweroff
70+
:board: frdm_mcxn236/mcxn236
71+
:goals: build flash
72+
:compact:
73+
74+
Building and Running for NXP FRDM-MCXN947
75+
=========================================
76+
Build the application for the :zephyr:board:`frdm_mcxn947` board.
77+
Note: After wakeup, the chip goes through the entire reset process.
78+
79+
.. zephyr-app-commands::
80+
:zephyr-app: samples/boards/nxp/poweroff
81+
:board: frdm_mcxn947/mcxn947/cpu0
82+
:goals: build flash
83+
:compact:
84+
85+
Building and Running for NXP MIMXRT595-EVK
86+
==========================================
87+
Build the application for the :zephyr:board:`mimxrt595_evk` board.
88+
Note: After wakeup, the chip goes through the entire reset process.
89+
90+
.. zephyr-app-commands::
91+
:zephyr-app: samples/boards/nxp/poweroff
92+
:board: mimxrt595_evk/mimxrt595s/cm33
93+
:goals: build flash
94+
:compact:
95+
96+
Sample Output
97+
=============
98+
FRDM-MCXA153, FRDM-MCXA156, FRDM-MCXA166, FRDM-MCXA276 FRDM-MCXN236, FRDM-MCXN947,
99+
MIMXRT595-EVK, output
100+
----------------------------------------------------------------------------------------
101+
102+
.. code-block:: console
103+
104+
*** Booting Zephyr OS build v4.2.0-rc1-255-gf71b531cb990 ***
105+
Press 'enter' key to power off the system
106+
Will wakeup after 5 seconds
107+
Powering off
108+
109+
FRDM-MCXN236 output
110+
--------------------
111+
112+
.. code-block:: console
113+
114+
*** Booting Zephyr OS build v4.2.0-rc3-17-g70b7c64e1094 ***
115+
Press 'enter' key to power off the system
116+
Will wakeup after press wakeup button
117+
Powering off

0 commit comments

Comments
 (0)