Need Help with DFU Status Handling Before Confirmation Event

Hello,

  I am using nRF Connect v2.6.0 and nrf52832 for product development.

 

 I have implemented MCUmgr callbacks to check the DFU status, as shown in the code snippet below:

 


enum mgmt_cb_return mgmt_dfu_function(uint32_t event, enum mgmt_cb_return prev_status,
                                int32_t *rc, uint16_t *group, bool *abort_more,
                                void *data, size_t data_size)
{
    if (event == MGMT_EVT_OP_IMG_MGMT_DFU_STARTED) {
        /* DFU started*/
        send_ui_event(UI_EVENT_LED_DFU_STARTED );
    }else if (event == MGMT_EVT_OP_IMG_MGMT_DFU_STOPPED)
    {

    }else if (event == MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED){
	//Success
        send_ui_event(UI_EVENT_LED_SUCCESS);
    }


    /* Return OK status code to continue with acceptance to underlying handler */
    return MGMT_CB_OK;
}



#if defined(CONFIG_MCUMGR_MGMT_NOTIFICATION_HOOKS)
    mgmg_dfu_callback.callback = mgmt_dfu_function;
    mgmg_dfu_callback.event_id = (MGMT_EVT_OP_IMG_MGMT_DFU_STARTED|
                                MGMT_EVT_OP_IMG_MGMT_DFU_STOPPED |
                                MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED);
    mgmt_callback_register(&mgmg_dfu_callback);
#endif

Using this callback, I can catch the event when DFU is started and Finished successfully.

However, I would like to get additional status or event before receive 'MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED' event

The device resets after the DFU image is fully transferred. and  'MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED' event is triggered.  Before 'MGMT_EVT_OP_IMG_MGMT_DFU_CONFIRMED' event is triggered, I would like to track the DFU process status right before this confirmation, allowing me to manage the LED status or handle other operations accordingly.

One potential solution could be storing the status in flash memory, but I would appreciate any advice or alternative approaches—especially if there are additional methods using MCUmgr callbacks—before proceeding further.

 

Thank you for your assistance.

  

Parents Reply Children
Related