Modifying Bootloader Settings Page from Main App

Hello,

SDK:17.10

MCU:nRF52833

Hello,

I want to receive new firmware via BLE at the application layer(not the bootloader ) and store it in bank1.

I have already done the validation and just want the bootloader to activate the FW by moving the image from Bank 1 to Bank 0.

I process DFU as per below:

1. Convert application HEX to BIN.

2. Send whole firmware image over BLE and store in flash (Bank1) in application code.

3. Update bootloader setting and reset the device and let bootloader to control the image update process.

According to the app_activate(void) function, I only need to modify the following parameters in the setting structure to complete the upgrade:

s_dfu_settings.bank_1.bank_code = NRF_DFU_BANK_VALID_APP;
s_dfu_settings.bank_0.bank_code = NRF_DFU_BANK_INVALID;

s_dfu_settings.bank_1.image_size = fwSize;

s_dfu_settings.progress.update_start_address = startAddress;

But modify these parameters and rewrite the setting page, reset, the firmware has not completed the upgrade and has been stuck in the bootloader.

What should I do to make the bootlaoder copy the firmware of bank1 to bank0 and skip the verification(becasue I have already done the validation and just want the bootloader to activate the FW by moving the image from Bank 1 to Bank 0. )

best gards

  • Hi Ryon,

    Many of my colleagues in Norway are on vacation and Our nRF5SDK bootloader expert is on vacation and will return to work next week. We will have to wait until then. Thanks for your patience so far.

  • Hi Ryon, 

    I'm sorry for late response. 
    Have you tried to test with the debug version of the bootloader and step into the code to see why it didn't continue the DFU process and swap the application. 

    I think it worth to check out an example my colleague Vidar has made a while ago on background DFU: 
    devzone.nordicsemi.com/.../187534

  • Hello,

    I have seen the background update done by your colleague Vidar, but I am not the same as him, he handles the image and init command by copying the DFU request handling from the bootloader to the application.I only receive the image through my own BLE communication protocol, then update the setting, reset and jump to the bootloader, and execute the copy program from bank1 to bank0.

    I have used the debug version to test, but I can’t debug, because I received the firmware->updated the settings page->reset -> the problem occurs after re-jumping to the bootloader(I checked the log through RTT and found that it stopped as below)

    so my question is :If I only receive the firmware (.bin) at the application layer and store it in bank1, how should I let the bootloader skip receiving the update package(.zip) and various verifications and go directly to copying the program of bank1 to bank0?

    As far as I know, the following parameters in the setting need to be updated:
    s_dfu_settings.bank_1.bank_code = NRF_DFU_BANK_VALID_APP;
    s_dfu_settings.bank_0.bank_code = NRF_DFU_BANK_INVALID;
    s_dfu_settings.bank_1.image_size = fwSize;
    s_dfu_settings.progress.update_start_address = startAddress;
    But after I update these parameters, the firmware cannot be successfully updated.

    thanks and regards

  • Hi Ryon, 

    I don't think I fully understand what you meant by 

    Ryon_pan said:
    he handles the image and init command by copying the DFU request handling from the bootloader to the application

    As far as I know the way it work is that the application will handle the DFU packet directly from UART not via the bootloader. The bootloader and the application doesn't run at the same time. 

    I think there is some protection mechanism that not allow the application to write directly to bootloader setting. It's been a while I haven't looked in to the bootloader source code, but I would suggest to do a full search for where in the bootloader you find: 
    the check for NRF_BL_DFU_ALLOW_UPDATE_FROM_APP 
    These are where the bootloader can be changed so that it support what you want to achieve. 

    Also pay attention to NRF_DFU_IN_APP , it's the configuration you need in your app when you use nrf_dfu_utils.c to write to bootloader setting. 

Related