File tree Expand file tree Collapse file tree 3 files changed +51
-0
lines changed
samples/boards/nordic/system_off Expand file tree Collapse file tree 3 files changed +51
-0
lines changed Original file line number Diff line number Diff line change @@ -23,4 +23,9 @@ config LPCOMP_WAKEUP_ENABLE
2323 help
2424 Enable system off wakeup from analog comparator.
2525
26+ config SYS_CLOCK_DISABLE
27+ bool "Power down system clock before system off"
28+ help
29+ System clock and GRTC will be switched off during system off.
30+
2631source "Kconfig.zephyr"
Original file line number Diff line number Diff line change @@ -47,6 +47,44 @@ tests:
4747 - " Off count: 0"
4848 - " Active Ticks:"
4949 - " Entering system off; press sw0 to restart"
50+ sample.boards.nrf.system_off.grtc_off :
51+ platform_allow :
52+ - nrf54l15dk/nrf54l05/cpuapp
53+ - nrf54l15dk/nrf54l10/cpuapp
54+ - nrf54l15dk/nrf54l15/cpuapp
55+ - nrf54lm20dk/nrf54lm20a/cpuapp
56+ extra_configs :
57+ - CONFIG_SYS_CLOCK_DISABLE=y
58+ harness : console
59+ harness_config :
60+ type : multi_line
61+ ordered : true
62+ regex :
63+ - " system off demo"
64+ - " Retained data not supported"
65+ - " System clock will be disabled"
66+ - " Entering system off; press sw0 to restart"
67+ sample.boards.nrf.system_off.retained_mem.grtc_off :
68+ platform_allow :
69+ - nrf54l15dk/nrf54l05/cpuapp
70+ - nrf54l15dk/nrf54l10/cpuapp
71+ - nrf54l15dk/nrf54l15/cpuapp
72+ - nrf54lm20dk/nrf54lm20a/cpuapp
73+ extra_configs :
74+ - CONFIG_APP_USE_RETAINED_MEM=y
75+ - CONFIG_SYS_CLOCK_DISABLE=y
76+ harness : console
77+ harness_config :
78+ type : multi_line
79+ ordered : true
80+ regex :
81+ - " system off demo"
82+ - " Retained data: valid"
83+ - " Boot count: 1"
84+ - " Off count: 0"
85+ - " Active Ticks:"
86+ - " System clock will be disabled"
87+ - " Entering system off; press sw0 to restart"
5088 sample.boards.nrf.system_off.grtc_wakeup :
5189 platform_allow :
5290 - nrf54l15dk/nrf54l05/cpuapp
Original file line number Diff line number Diff line change 1717#include <zephyr/pm/device.h>
1818#include <zephyr/sys/poweroff.h>
1919#include <zephyr/sys/util.h>
20+ #include <zephyr/drivers/timer/system_timer.h>
2021
2122#define NON_WAKEUP_RESET_REASON (RESET_PIN | RESET_SOFTWARE | RESET_POR | RESET_DEBUG)
2223
@@ -97,11 +98,15 @@ int main(void)
9798 printf ("Retained data not supported\n" );
9899 }
99100
101+ #if defined(CONFIG_SYS_CLOCK_DISABLE )
102+ printf ("System clock will be disabled\n" );
103+ #endif
100104#if defined(CONFIG_GRTC_WAKEUP_ENABLE )
101105 int err = z_nrf_grtc_wakeup_prepare (DEEP_SLEEP_TIME_S * USEC_PER_SEC );
102106
103107 if (err < 0 ) {
104108 printk ("Unable to prepare GRTC as a wake up source (err = %d).\n" , err );
109+ return 0 ;
105110 } else {
106111 printk ("Entering system off; wait %u seconds to restart\n" , DEEP_SLEEP_TIME_S );
107112 }
@@ -141,6 +146,9 @@ int main(void)
141146 }
142147
143148 hwinfo_clear_reset_cause ();
149+ #if defined(CONFIG_SYS_CLOCK_DISABLE )
150+ sys_clock_disable ();
151+ #endif
144152 sys_poweroff ();
145153
146154 return 0 ;
You can’t perform that action at this time.
0 commit comments