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
  • Hi Benjamin

    Do you add SOFTDEVICE_PRESENT into the preprocessor Definitions as the figure? 

    The code should work when the SOFTDEVICE_PRESENT is added into the preprocessor Definitions. 

    #ifdef SOFTDEVICE_PRESENT
            if (nrf_sdh_is_enabled())
            {
                ret_code_t ret_code = sd_power_system_off();
                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
            }
    #endif // SOFTDEVICE_PRESENT

    -Amanda H.

  • HI , nrf52832 with SDK v16 on that using this nus example location below mentioned

    examples\ble_peripheral\ble_app_uart\pca10040\s132

    in this example, didn't change anything  whenever the program starts  start advertising until APP_ADV_DURATION time 180 sec  after that program terminates receiving a fatal error

    while entering sleep mode in this function sd_power_system_off() APP error check reciving fatal erroe 

    check this issue help me!!

Reply
  • HI , nrf52832 with SDK v16 on that using this nus example location below mentioned

    examples\ble_peripheral\ble_app_uart\pca10040\s132

    in this example, didn't change anything  whenever the program starts  start advertising until APP_ADV_DURATION time 180 sec  after that program terminates receiving a fatal error

    while entering sleep mode in this function sd_power_system_off() APP error check reciving fatal erroe 

    check this issue help me!!

Children
Related