Skip to content

Commit e02acca

Browse files
pepe2kcarlescufi
authored andcommitted
samples: cc13x2_cc26x2: system_off: fix force state usage
This is the same fix as the one introduced in 49520ee ("samples: nrf: system_off: Fix force state usage") for nRF boards. Quoting original commit: The sample cannot spin in an infinity loop because the idle thread will not run and consequently the forced state will not be used. Without this fix, the system doesn't enter SOFT_OFF state: *** Booting Zephyr OS build zephyr-v3.0.0-3495-ga456c5274614 *** cc1352r1_launchxl system off demo Busy-wait 5 s Sleep 2000 us (IDLE) Sleep 3 s (STANDBY) Entering system off (SHUTDOWN); press BUTTON1 to restart ERROR: System off failed Signed-off-by: Piotr Dymacz <[email protected]>
1 parent 9bd97eb commit e02acca

File tree

1 file changed

+6
-0
lines changed
  • samples/boards/ti/cc13x2_cc26x2/system_off/src

1 file changed

+6
-0
lines changed

samples/boards/ti/cc13x2_cc26x2/system_off/src/main.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ void main(void)
6969
*/
7070
pm_state_force(0u, &(struct pm_state_info){PM_STATE_SOFT_OFF, 0, 0});
7171

72+
/* Now we need to go sleep. This will let the idle thread runs and
73+
* the pm subsystem will use the forced state. To confirm that the
74+
* forced state is used, lets set the same timeout used previously.
75+
*/
76+
k_sleep(K_SECONDS(SLEEP_S));
77+
7278
printk("ERROR: System off failed\n");
7379
while (true) {
7480
/* spin to avoid fall-off behavior */

0 commit comments

Comments
 (0)