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

BLE Background DFU function support

Hi Nordic ,

I have a nRF52840 project development based on SDK 15.3 . Now ,I need to add DFU feature there. we suppose to use background DFU here. we will use long range( coded PHY S8), and long connection parameter . 

form my study ,I can use IOT bootloader example from my bootloader.

but about the DFU function, can you give me the hint and reference for DFU function implement ?

I am not idea on how to save the New fw package during the application status now. Thanks.

  • HI Edvin ,

    I found the solution for my UICR issue , I can write it in my application parts at first programming.

    Then I meet other issue during my development, I would like to do the dfu transport in my application.

    1. once I program the application and SoftDevice Only, it will said error like this, 

    <error> app: No bootloader was found
    <debug> app: nrf_dfu_svci_vector_table_set() -> NRF_ERROR_NO_MEM
    <error> app: ERROR 4 [NRF_ERROR_NO_MEM] at ..\..\..\usr_BLE.c:1085
    PC at: 0x00026C6D
    <error> app: End of error report

    2. if I try to merge all hex file together by mergehex tool like this .

    nrfutil settings generate  --application application.hex  --family NRF52840  --application-version 1  --bootloader-version 1  --bl-settings-version 2 --softdevice s140_SD.hex O_bootloader_setting.hex 
    
    :: Merge for Bootloader with mapping setting 
    mergehex --merge bootloader.hex O_bootloader_setting.hex --output O_Mapped_Bootloader.hex 
    
    :: Merge for Application and SoftDevice 
    mergehex --merge s140_SD.hex application.hex --output O_App_SD.hex
    
    :: Merge for Bootloader and SoftDevice
    mergehex --merge s140_SD.hex O_Mapped_Bootloader.hex --output O_Boot_SD.hex 
    
    :: Merge for Application , SoftDevice and Bootloader
    mergehex --merge  s140_SD.hex application.hex O_Mapped_Bootloader.hex --output O_Boot_App_SD.hex
    


    then , flash the new hex by jflash. I found it cannot start my application, always reboot in bootloader, 

    00> <info> app: Inside main
    00> 
    00> <debug> app: In nrf_bootloader_init
    00> 
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <debug> nrf_dfu_settings: Using settings page.
    00> 
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <debug> app: Enter nrf_bootloader_fw_activate
    00> 
    00> <info> app: No firmware to activate.
    00> 
    00> <debug> app: App is valid
    00> 
    00> <info> nrf_dfu_settings: Settings backup not available from app.
    00> 
    00> <error> app: Received a fault! id: 0x00004002, pc: 0x00000000, info: 0x2000B500
    00> 
    00> <info> app: Inside main
    00> 
    00> <debug> app: In nrf_bootloader_init
    00> 
    00> <debug> nrf_dfu_settings: Calling nrf_dfu_settings_init()...
    00> 
    00> <debug> nrf_dfu_flash: Initializing nrf_fstorage_nvmc backend.
    00> 
    00> <debug> nrf_dfu_settings: Using settings page.
    00> 
    00> <debug> nrf_dfu_settings: Copying forbidden parts from backup page.
    00> 
    00> <debug> nrf_dfu_settings: Destination settings are identical to source, write not needed. Skipping.
    00> 
    00> <debug> app: Enter nrf_bootloader_fw_activate
    00> 
    00> <info> app: No firmware to activate.
    00> 
    00> <debug> app: App is valid
    00> 
    00> <info> nrf_dfu_settings: Settings backup not available from app.
    00> 
    00> <error> app: Received a fault! id: 0x00004002, pc: 0x00000000, info: 0x2000B500
    00> 
    (Connection lost)

    I just used the ....\examples\dfu\secure_bootloader example as my bootloader.

    so I want to know what I missing to start my application with bootloader ? 

    why it cannnot boot to my application?

  • Hi Edvin , 

    There are more detail for you ,

    <method for generating hex file >

    for Bootloader's hex file ,I using the the example in folder ....\examples\dfu\secure_bootloader\pca10056_ble_debug\ , and complie the hex with key value by IAR.

    then I using the mergeHex tool to get a bootloader_w_setting.hex , which only contain the setting and bootloader

    <method for generating app and Softdevice file >

    Softdevice : copy from SDK folder .....\components\softdevice\s140\hex\ 

    Application parts  : is my development project , which has testing before . it can opeartion with softDevice, but no bootloader here .

    <methodfor programming the Chip>

    I tried to flash the 4 in1 hex (bootloader + bootloader setting + application + SoftDevice)file after merged by JFlash, then  reset and run , it perfromed fail with above debug log, always reboot in bootloader.

    I also tried to use nRF connect Programmer to loading the bootloader_w_setting.hex , softdevice and application to my board. it failed wiht same result as above log.

    please comment my process is anything missing or wrong ,thanks.

  • It looks like the issue you are facing is that the application can't find any bootloader, and throws an error because of this. When you program the bootloader, and it doesn't start the application, it is probably because you don't have any bootloader settings matching the application. 

    I see that you generate some settings, but you don't use the private key in the settings. Try to add it. Type the command "nrfutil settings generate" to see all possible parameters.

    Perhaps you can try to import the normal error handler that is used in the SDK examples (except for the bootloader) to see what APP_ERROR_CHECK() that returned != NRF_SUCCESS. Alternatively, try to step in the code around:

    00> <info> nrf_dfu_settings: Settings backup not available from app.

    and see if you can find out which one it is?

    BR,

    Edvin

Related