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

How to run app directly after burning bootloader?

Hi, 

I am using NRF52832 and SDK 11

I tried to include DFU function into the device. I merged bootloader (from modified bootloader example), application, softdevice into one HEX file, and use nRFgo Studio to burn the HEX into the device. But after powered on, the device always immediately advertising as "DfuTarg" instead of running the main application. If I use nRFConnect App to connect this "DfuTarg", then I can use OTA to update the application to the device, then it will run the main application with DFU perfectly.

Why is that? Did I miss something?

Thanks

Parents
  • Hi,

    On startup, the bootloader will check if there is a valid app in bank 0 (memory layout) by checking the value of p_bootloader_settings->bank_0 stored in the bootloader settings page @ 0x3FC00. It will only boot the app if the bank code == BANK_VALID_APP (0x01). 

    The settings page is managed by the bootloader when you do DFU and it will set the bank0 code to BANK_VALID_APP after a successful application update. However, it will not be set if you program sd+bl+app with a debugger so the bootloader will not know that a valid application is present in bank 0. But you can mark the application as valid by setting the flag manually valid with nrfjprog after you've programmed everything : 

    > nrfjprog --memwr 0x3FC00 --val 1 (BANK_VALID_APP)

    > nrfjprog -r // Reset device - app should start on subsequent boot

    Also, since you are using SDK 11 with nRF52, it's important that you use a more recent version of system_nrf52.c that includes workaround for errata #108. This file is distributed with our MDK

     

  • Hi Vidar,

    Thanks for your reply. 

    But both "nrfjprog --memwr 0x3FC00 --val 1" and "nrfjprog -r" return ERROR: There is no debugger connected to the PC with the given serial number.

    However, if I use "nrfjprog -f NRF52 --program "C:\myfile.hex" --verify --chiperase" command to program the chip, then it won't ask about serial number and can sucessfully download the file to the chip.

Reply
  • Hi Vidar,

    Thanks for your reply. 

    But both "nrfjprog --memwr 0x3FC00 --val 1" and "nrfjprog -r" return ERROR: There is no debugger connected to the PC with the given serial number.

    However, if I use "nrfjprog -f NRF52 --program "C:\myfile.hex" --verify --chiperase" command to program the chip, then it won't ask about serial number and can sucessfully download the file to the chip.

Children
Related