Why does nRF52 hrs sdk11 example sd_power_off return 6?

syntroniks gravatar image

asked 2016-08-10 20:05:41 +0100

Hello all: I am running a nRF52832QF AAB0 pca10040 board with SDK11 in Segger embedded studio. I followed the 'getting started' tutorial.

After pressing button 1, I noticed an error handler was being triggered. It was the sd_power_system_off call in sleep_mode_enter. This error is also thrown when the device attempts to sleep after advertising times out.

The SD 132 v2.0.0 is initialized prior to this error being thrown. The error is 0x2006, not supported. Surely system off is supported on the nrf52...

Additionally I am using RTT logging if that may make a difference. I'm eager to get up and running with S132 3.0 and SDK12.

edit retag flag offensive close delete report spam


2 answers

Sort by ยป oldest newest most voted
Aryan gravatar image

answered 2016-08-11 09:08:41 +0100

updated 2016-08-12 08:08:19 +0100

This is defined in nrf_error_soc.h


The reason is explained by Emulated system off mode.

If the device is in debug interface mode, System OFF will be emulated to secure that all required resources needed for debugging are available during System OFF. See Debug and trace on page 99 for more information. Required resources needed for debugging include the following key components: Since the CPU is kept on in an emulated System OFF mode, it is recommended to add an infinite loop directly after entering System OFF, to prevent the CPU from executing code that normally should not be executed.

In normal system off mode, the CPU goes to deep sleep and on wakeup a reset is generated and the CPU execution starts from address 0x0. In emulated system OFF, the CPU keeps on going, but the wakeup resource will generate a reset. sd_power_system_off() function expects that it should not return which is correct in non debug mode.

I would suggest to to ignore the error in debug mode

#ifdef DEBUG_NRF
 (void) sd_power_system_off();
#endif  // DEBUG_NRF

you have to manually add this (DEBUG_NRF) flag in your project.

edit flag offensive delete publish link more


That looks interesting. So theoretically a wakeup source (let's pick an IO pin, maybe a button press) will in fact generate a reset when in emulated system OFF. Is that correct? Perhaps I will add that while loop.

Thanks for the snippet!

syntroniks ( 2016-08-11 21:35:42 +0100 )editconvert to answer

forgot to add while loop in debug mode. fixed it now . Yes both in normal system off and emulated system off, wakeup source will generate a reset.

Aryan ( 2016-08-12 08:08:45 +0100 )editconvert to answer
syntroniks gravatar image

answered 2016-08-10 20:08:47 +0100

updated 2016-08-10 20:12:07 +0100

Proposed solution after some searching: https://devzone.nordicsemi.com/questi...

Will investigate and report back.


You can not call sd_power_system_off when a debugger is attached.

(you can, it just won't work)

I have confirmed the application runs as expected when the debugger is not attached. The error code makes sense, this is a good example of a 'gotcha'. The nice thing about mistakes is you never have to make the same one again for the rest of your life. Now I know.

edit flag offensive delete publish link more


I've seen errors like this when you try and call an sd_ function without having initialized the softdevice.

Dave_couling ( 2016-08-11 01:40:11 +0100 )editconvert to answer

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer. Do not ask a new question or reply to an answer here.

[hide preview]

User menu

    or sign up

Recent questions

Question Tools

1 follower


Asked: 2016-08-10 20:05:41 +0100

Seen: 890 times

Last updated: aug. 12 '16