I hope this isn't a duplicate of another question. I searched on sd_power_system_off and didn't see anything exactly like this.
I'm creating a new project, based on ble_app_template from SDK 11.0.0 . So far, all I've done is tested to make sure my combination of services advertises correctly. It does, but I noticed via debug output that the application restarts regularly and I tracked it to the sleep_mode_enter call (due to advertising timeout) and sd_power_system_off. The latter call is made and immediately exits with error NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN.
What might cause this?
I'm attaching my main.c.
The chip cannot be put in system_off when in Debug mode. It will most likely work when you run it without the debugger, but you should confirm this with a test.
I am running with a PCA10036 board (IAR compiler). I also just confirmed that this happens with the bare 'ble_app_template' demo.
The chip will be put in emulated system off mode if in debug interface mode and calling sd_power_system_off(). This will lead to the CPU executing code after the call. Therefore it is recommended to add an infinite loop after going system off. See this and this post.
Confirmed! Thank you
How do I know if I'm in debug mode or not?