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

start app after dfu uploading nrf52

Hi,

I'm using "bootloader secure" example from sdk 12.2 and I modify it for instead of use button to enter in DFU, use a value written in a memory position.

As in other bootloaders I used, for example, bootloader of sdk 6.1, when the zip upload was finished, the app starts automatically. The function wait_for_events detects flag BOOTLOADER_COMPLETE and executes the function bootloader_app_start in main function. In this new sdk 12.2 I thought that this will be the same, but I don't find the function or the flag that tolds that the upload is complete.

This is important because I need to start the app after the firmware upload because I have to rewrite the byte in memory in order to not enter again in dfu mode.

How and where can I start the application just after the firmware upload?

Thanks!

  • Hi Abosh,

    the secure bootloader in SDK v12.x behaves the same way, i.e. it will start the application automatically after the update is completed, and you should not have to do any modifications to the bootloader. However, it is important that you clear the byte stored in flash to indicate that the device should enter bootloader mode immediately after entering the bootloader.

    The secure bootloader will not wait for a specific event in the wait_for_event() function in nrf_dfu_init() (nrf_dfu.c), but perform a SoftReset when the application update is complete and then re-enter nrf_dfu_init(), go past the if-statement that starts the bootloader

     if(enter_bootloader_mode != 0 || !nrf_dfu_app_is_valid())
        {
             ....
        }
    

    and enter the following if-statement

    if (nrf_dfu_app_is_valid())
        {
            NRF_LOG_INFO("Jumping to: 0x%08x\r\n", MAIN_APPLICATION_START_ADDR);
            nrf_bootloader_app_start(MAIN_APPLICATION_START_ADDR);
        }
    

    and start the application.

    Best regards

    Bjørn

Related