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

System resets on sd_power_system_off

Hi,

I want to power the system off when a a characteristic is written. I do so by calling sleep_mode_enter function listed below. When sd_power_system_off is called the system resets instead of turning off. I read on other threads that this could be because of being in debug mode. I tried turning off everything related to debug mode and disconnecting the debug probe but the issue still exists. 

static void sleep_mode_enter(void)
{
    ret_code_t err_code;

    err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    APP_ERROR_CHECK(err_code);

    // Prepare wakeup buttons.
    err_code = bsp_btn_ble_sleep_mode_prepare();
    APP_ERROR_CHECK(err_code);

    // Go to system-off mode (this function will not return; wakeup will cause a reset).
    #ifdef DEBUG
     (void) sd_power_system_off();
     while(1);
    #else
      err_code = sd_power_system_off();
      APP_ERROR_CHECK(err_code);
    #endif  // DEBUG
}


What could be the reason? How do I make sure debug mode is properly disabled?
I found on another thread that I could use an #ifdef to check if DEBUG is defined and set an infinite loop after calling sd_power_system_off but that didn't help either!

Thanks

Parents Reply Children
No Data
Related