How Can I Update Firmware through DFU Bootloader and custom mobile app

Dear All,

I am working on a Bluetooth edge device with nRF Connect Environment. we are designing a product in which mobile application and battery operated edge device both are there. I went through some Nordic blogs and videos.

here is my understanding related to firmware update through DFU Bootloader(Nordic Provided Bootloader):

1> If I wants to update the device firmware we had to stick some required tools and configuration

2> we also needs to maintain separately nrf Connect App for image file transfer.

Here is my requirement :-

1> we are having cloud network also, we need to keep the file over cloud so as soon as file will be uploaded to the cloud mobile app should sync and receive this file to its local database.

2> whenever device will be connected to the mobile app(not nRF Connect its client app), app will send a notification to edge device. Edge device should receive this file and store in its 

     in its external memory.

3> then bootloader should start and replacing the updated f/w with new f/w 

My question is:- Can DFU Bootloader(Nordic Provided DFU Bootloader) fulfil my project requirement?  if yes please provide some help.

Thanks & Regards

Sabir Khan

  • Hi,

    I found the below Nordic link for Firmware upgrade using external Flash over SPI. I have taken Peripheral_lbs example as base code.

    https://github.com/simon-iversen/sdk-zephyr/tree/serial_dfu_ext_flash_hello_world/samples/hello_world

    but whenever I am trying to compile same its throwing errors. my query is in the link above if you see there is 1 another folder which is named as child image, its also having prj.config and .overlay file. why it is required? I wants to use secondary slot in SPI external flash that's why I am referring this.

    I have already done Firmware upgrade with the help of below link.

     Add DFU support to your application  here there is no concept of child image and all. only single file is been generated as app_update.bin. I just flashed the same code through J-Tag and after changing few line and compiling the project again generated the file and uploaded the bin file successfully through OTA(device manager app). 

    right now I am following the below steps for external flash.

    1st Step> Modify overlay file as per below:-

    2nd Step> Modify prj.config as like:-

    ##################### OTA Config #############################

    # Enable mcumgr.
    CONFIG_MCUMGR=y

    # Enable most core commands.
    CONFIG_MCUMGR_CMD_IMG_MGMT=y
    CONFIG_MCUMGR_CMD_OS_MGMT=y

    # Ensure an MCUboot-compatible binary is generated.
    CONFIG_BOOTLOADER_MCUBOOT=y
    CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
    # Allow for large Bluetooth data packets.
    CONFIG_BT_L2CAP_TX_MTU=252
    CONFIG_BT_BUF_ACL_RX_SIZE=256

    # Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
    CONFIG_MCUMGR_SMP_BT=y
    CONFIG_MCUMGR_SMP_BT_AUTHEN=n

    # Enable the LBS service
    CONFIG_BT_LBS=y
    CONFIG_BT_LBS_POLL_BUTTON=y
    CONFIG_DK_LIBRARY=y

    ################# OTA CONFIG END ######################################

    ##############
    CONFIG_GPIO=y
    CONFIG_LOG=y

    # Configure Bluetooth Low Energy.
    CONFIG_BT=y
    CONFIG_BT_PERIPHERAL=y
    CONFIG_BT_DEVICE_NAME="NDC12345672"
    CONFIG_BT_DEVICE_APPEARANCE=0
    CONFIG_BT_MAX_CONN=1
    CONFIG_BT_LL_SOFTDEVICE=y


    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=10240

    CONFIG_I2C=y
    #CONFIG_NO_OPTIMIZATIONS=y
    CONFIG_SPI=y
    CONFIG_FLASH=y
    CONFIG_STDOUT_CONSOLE=y
    CONFIG_CBPRINTF_FP_SUPPORT=y


    3rd Step> try to Add pm_static.yml file to project directory. it is having following content.
    4th Step> but due pm_static.yml file error been generated as seen below so I just changed the name from pm_static.yml to pm.yml file. all the errors resolved.
    5th step> Flashed the code through J-Tag. no response seemed from firmware. I try to debug and put a breakpoint at main itself, It never came here. it looks like it is trapped here as below
    I was thinking if it is done successfully and responding, I will change again some lines of the code and make binary file app_update.bin and then upload through device manager app. but unfortunately I couldn't reach up to here.  
    Can you please guide me step by step which step I am doing mistake. 
    Heartly thanks in advance!!
  • Hi,

    The guides you have referred to are quite old. I suggest you refer to the examples I suggested, or just do a few changes that are needed, as explained in this post. If it does not work, perhaps you can show all your changes and the full build log / errors? (You can post code/logs in a readable way using Insert -> Code)

Related