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

nRF52 DFU questions

I'm using nRF52 + SDK11.0.0 + s132 and have a couple of questions on DFU.

  1. I want to use a CMSIS-DAP programmer + OpenOCD to upload the bootloader (or BL+SD+APP+setting) hex files. The application/SD boot up, but the bootloader keeps cycling on any attempt to do a DFU (due to the APP_ERROR_CHECK for the boolloader address). I can power cycle to go back to the app. This works fine using the IDAP-Link + idapnrfrog.exe or J-Link + nrfjprog.exe. Reading back the UICR using nrfjprog shows 0x10001014 = 0xffffffff when using OpenOCD, but it has the proper address when using the other tools. How can I properly upload the bootloader (and set the UICR) using CMSIS-DAP + OpenOCD?
  2. I may upgrade to SDK13 in the future, but want to release my project now with SDK11. Since the BL and SD and both be updated via DFU, can I allocated extra space for the bootloader and soft device now so that the new ones will fit later?
  3. This thread states that "Also, start address and size of the memory for the bootloader must add up to 0x00040000 bytes (the end of the application area in the flash)." Per the memory map here, I see this is the case for nRF51, but nRF52 project's defaults shows start 0x7A000 and size 0x4000, which doesn't go the the end of application space. Please clarify.
  • Hi Tosa,

    I dont have experience with OpenOCD. But it seems that this person managed to write to UICR ?

    2.Yes you should give enough space because the Secure bootloader from SDK v12 requires more space than the one on SDK v11. To change the start address of the bootloader, have a look here.

    3.You are right. The documentation was written when there was no nRF52. It was for 256kB max size flash. If you are using nRF52 with 512kB flash size, the limit is 0x80000.

  • Hi Hung,

    Regarding:

    1. It turned out to be an issue with my nrf52.cfg file (missing the UICR flash bank); it's okay now.
    2. Just to be sure, the bootloader doesn't know/care about the existing app and SD sizes/start locations? For example, if I update the softdevice, the app would be wiped out regardless of the size of the new softdevice, so that the new softdevice can be stored outside the existing softdevice's flash area before being copied to the proper flash address, correct?
    3. dfu_types.h clarifies that the nRF52 uses two 0x1000 byte pages for BOOTLOADER_SETTINGS_ADDRESS and BOOTLOADER_MBR_PARAMS_PAGE_ADDRESS vs the nRF51 uses one 0x400 byte page for BOOTLOADER_SETTINGS_ADDRESS only, hence the difference in bootloader sizes.
  • 2.When you tell the bootloader that you are going to update softdevice it won't check for current SD and current application any more, as they will be wiped out.You are correct about the way we receive new softdevice, the application will be erased as the swap region.

    3.I see, I was thinking of the bootloader and the bootloader setting as a whole. But yet, they should be taken into account when you calculate the actual max size of the bootloader.

Related