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

buttonless DFU issue loading with jlink

Hello,

we are using the nRF52840-DK.

 

File: secure_bootloader_ble_s140_pca10056.emProject

File: ble_app_buttonless_dfu_pca10056_s140.emProject

 

In short, we are noticing when uploading through SES with Jlink, the uicr_bootloader_start_address 0xff8 memory location is being modified to be all "F". The Bootloader example works in the case when the bootloader_example.zip is uploaded using the DFU.

Overview:

File: secure_bootloader_ble_s140_pca10056.emProject

File: ble_app_buttonless_dfu_pca10056_s140.emProject

Board: nRF52840-DK

Intent: Add buttonless dfu feature to our existing ble project.

Issue 1: Buttonless example is successful when uploading the package.zip using the DFU. When uploading Buttonless example with J-Link through SES, we get an err_code = 4, resulting in NRF_BREAKPOINT_COND.

When uploading with SES/J-Link the 0x1000 (4096) page is being written to and this is causing the uicr_bootloader_start_address @ 0xff8 location to be erased, and is reading 0xffff-ffff. We are expecting the uicr_bootloader_start_address @ 0xff8 to be 0xF8000.

I believe the reason the DFU transfer of the buttonless example works, is because the bootloader is protecting the flash from being overwritten (Line 32 of secure bootloader main.c). While the SES upload is not protecting that space.

Question: Why is the project writing to 0x0 – 0xfff?

Modifications made to our application: We have an existing BLE application we are developing, and are adding the buttonless dfu feature to our application. I will list the settings I have modified in my attempt to get the buttonless dfu feature working on our application.

After making these changes our application does not work with both upload methods, SES/J-Link or, DFU. The 0xff8 memory issue described above is also seen with our application.

  • Modified main.c to include buttonless features
  • Include several SDK files into the project
    • nRF_DFU folder
      • c
      • c
      • c
    • nRF_SVC folder
      • c
    • Add user include directories
      • ../nRF5-SDK/components/libraries/bootloader/ble_dfu
      • ../nRF5-SDK/components/libraries/bootloader/dfu
      • ../nRF5-SDK/components/libraries/bootloader
      • ../nRF5-SDK/components/libraries/svc
    • Add Preprocessor Defines Code>>Preprocessor>>Preprocessor Definitions (Common)
      • BL_SETTINGS_ACCESS_ONLY
      • NRF_DFU_SVCI_ENABLED
      • NRF_DFU_TRANSPORT_BLE=1
    • Modified sdk_config.h
      • Note: These were the only defines different in our app vs the buttonles example. These are the values I kept in our app.
      • BLE_DFU_ENABLED 1
      • NRF_PWR_MGMT_CONFIG_AUTO_SHUTDOWN_RETRY 1
      • NRF_LOG_BACKEND_RTT_ENABLED 1
    • xml
      • added "uicr_bootloader_start_address" section
    • Added bootloader address to Build>>Memory Segments (Common)
      • "uicr_bootloader_start_address RX 0x00000FF8 0x4"

Buttonless_DFU_helpful memory map.docx

Parents
  • Question: Why is the project writing to 0x0 – 0xfff?

    Because these are documented locations for bootloader address. I think you are supposed to write to the MBR page without a page erase, but have no idea how to tell SES to do that.

    Fixed this problem by changing these addresses in the linker script to the alterative UICR addresses (NRFFW[0] and NRFFW[1] in UICR).

    For LD this looks like:

     uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
     uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4

Reply
  • Question: Why is the project writing to 0x0 – 0xfff?

    Because these are documented locations for bootloader address. I think you are supposed to write to the MBR page without a page erase, but have no idea how to tell SES to do that.

    Fixed this problem by changing these addresses in the linker script to the alterative UICR addresses (NRFFW[0] and NRFFW[1] in UICR).

    For LD this looks like:

     uicr_bootloader_start_address (r) : ORIGIN = 0x10001014, LENGTH = 0x4
     uicr_mbr_params_page (r) : ORIGIN = 0x10001018, LENGTH = 0x4

Children
Related