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

Trying to understand the function of the buttonless_dfu_sdh_state_observer() in ble_app_buttonless_dfu example

The buttonless_dfu_sdh_state_observer in this example is shutting down the cpu when the softdevice is disabled using an observer. 

static void buttonless_dfu_sdh_state_observer(nrf_sdh_state_evt_t state, void * p_context)
{
    if (state == NRF_SDH_EVT_STATE_DISABLED)
    {
        // Softdevice was disabled before going into reset. Inform bootloader to skip CRC on next boot.
        nrf_power_gpregret2_set(BOOTLOADER_DFU_SKIP_CRC);

        //Go to system off.
        nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);
    }
}

/* nrf_sdh state observer. */
NRF_SDH_STATE_OBSERVER(m_buttonless_dfu_state_obs, 0) =
{
    .handler = buttonless_dfu_sdh_state_observer,
};

I'm not sure why this is necessary in a dfu implementation.  Our app has this observer in it copied from the example.  When I disable the softdevice it triggers this method and shuts down the cpu when I don't want it to.

ps. nrf52832, sdk 15.3, s132

Parents Reply Children
Related