How can I add led blink effect into BT DFU

I am running on bluetooth demo: peripheral_uart, and enabled BT SMP DFU feature so that I can upgrade my firmware through bluetooth.

Everything went fine, and now I want to add some led blink effect into the dfu progress so that I can be informed of the dfu progress.

How to do it ?

  • Hello,

    Please check out this ticket, that a colleague of mine has answered:

     mcuboot CONFIG_MCUBOOT_ACTION_HOOKS 

    I believe what you are particularly interested in is the MCUmgr Callbacks

    The MGMT_EVT_OP_IMG_MGMT_DFU_CHUNK will (if enabled) trigger whenever a new chunk is uploaded. I have not tested this, but I believe when you enable this, you need this callback to return MGMT_CB_OK or MGMT_ERR_EOK (they are the same value) for the DFU process to continue. 

    As for the LEDs, you can look at the ncs\zephyr\samples\basic\blinky. This is a bit overkill, because it tests different combinations of duty cycles, but you can see in that sample how to use pwm_set_dt() to set the pwm period and duty cycle. 

    Best regards,

    Edvin

  • Oh, and please note that these event callbacks will only be available during the upload process. When the upload is complete, and the bootloader (MCUBOOT) takes over, the application no longer has access to the gpios/LEDs. If you need this in the bootloader as well, you would need to modify the bootloader. But I believe you will only be able to control stuff in the beginning. During the swap process (where it actually moves the new application to the execution slot), you will not be able to do much. 

    Best regards,

    Edvin

Related