Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf_pwr_mgmt bug

I think I've found a bug in the power management that occurs only when a softdevice and the debug interface are active. In SDK v17.0.2, nrf_pwr_mgmt.c lines 417-429:

            ret_code_t ret_code = sd_power_system_off();    // Expected ret_code is NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN
            ASSERT((ret_code == NRF_SUCCESS) || (ret_code == NRF_ERROR_SOFTDEVICE_NOT_ENABLED));
            UNUSED_VARIABLE(ret_code);
#ifdef DEBUG
            while (true)
            {
                /* 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. */
                __WFE();
            }
#endif

The ASSERT statement fails to catch the case where sd_power_system_off returns NRF_ERROR_SOC_POWER_OFF_SHOULD_NOT_RETURN with a debugger connected.

Parents Reply Children
Related