This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why does nRF52 hrs sdk11 example sd_power_off return 6?

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.

Parents
  • This is defined in nrf_error_soc.h

    NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN         (NRF_ERROR_SOC_BASE_NUM + 6)
    

    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();
     while(1);
    #else
      APP_ERROR_CHECK(sd_power_system_off());
    #endif  // DEBUG_NRF
    

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

  • 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.

Reply Children
No Data
Related