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

DFU application wait for Bond info to be saved?

Hello,

It appears that the function to jump into the bootloader is being called while the peer bonding information is still being saved.

Does the app_shutdown_handler() need to return false until the information is saved?

If so, how do you know when the save is complete? PM_EVT_PEER_DATA_UPDATE_SUCCEEDED doesn't tell me anything.

Thanks

  • No, the application will not jump to the bootloader(i.e. reset) before the peer data has been sucessfully written to flash.

    Calling nrf_dfu_set_peer_data() in enter_bootloader() will forward the peer data to the bootloader and initiate the flash write operation, nrf_dfu_set_peer_data() will then return NRF_SUCCESS.

    The application will then wait for the system event, which will result in the ble_dfu_buttonless_on_sys_evt() callback. This callback will call nrf_dfu_set_peer_data_on_sys_evt which checks whether the flash operation was successful, if so it will return NRF_SUCCESS. This will result in the is_waiting_for_reset flag being set to true, which will promt the application to finalize the reset procedure.

    TLDR: No need to wait for the peer data to be written to flash in app_shutdown_handler(), its already handled.

Related