MCUBOOT DFU Over Bluetooth Fails During Firmware Download – Need Help

"I'm trying to perform DFU using MCUBOOT over Bluetooth. The device enters DFU mode and connects successfully, but when I start the firmware download, I get an error:


Starting Bluetooth Peripheral LBS example
I: SoftDevice Controller build revision:
I: d6 da c7 ae 08 db 72 6f |......ro
I: 2a a3 26 49 2a 4d a8 b3 |*.&I*M..
I: 98 0e 07 7f |....
I: HW Platform: Nordic Semiconductor (0x0002)
I: HW Variant: nRF52x (0x0002)
I: Firmware: Standard Bluetooth controller (0x00) Version 214.51162 Build 1926957230
I: Identity: F6:41:05:EF:F1:85 (random)
I: HCI: version 5.4 (0x0d) revision 0x11fb, manufacturer 0x0059
I: LMP: version 5.4 (0x0d) subver 0x11fb
Bluetooth initialized
Advertising successfully started
E: invalid address: 0x001edff0:16
I: Secondary image of image pair (0.) is unreachable. Treat it as empty
I: Image index: 0, Swap type: none
E: invalid address: 0x001edff0:16
I: Secondary image of image pair (0.) is unreachable. Treat it as empty
I: Image index: 0, Swap type: none
E: invalid address: 0x001edff0:16
I: Secondary image of image pair (0.) is unreachable. Treat it as empty
I: Image index: 0, Swap type: none
E: Incorrect parameter
E: Irrecoverable error: flash write failed: 10


Below is my pm_static.yml file:


mcuboot:
  address: 0x0
  size: 0xc000
  region: flash_primary

mcuboot_pad:
  address: 0xc000
  size: 0x200
  region: flash_primary

mcuboot_primary:
  address: 0xc000
  size: 0xf1000
  region: flash_primary

app:
  address: 0xc200
  size: 0xe4e00
  region: flash_primary

mcuboot_secondary:
  address: 0xfd000
  size: 0xf1000
  region: flash_primary

second_storage:
  address: 0x1ee000
  size: 0x4000
  region: flash_primary
  placement:
    align:
      start: 0x1000
    before:
    - zboss_nvram

zboss_nvram:
  address: 0x1f2000
  size: 0x8000
  region: flash_primary
  placement:
    after:
    - second_storage
    align:
      start: 0x1000

zboss_product_config:
  address: 0x1fa000
  size: 0x1000
  region: flash_primary
  placement:
    after:
    - zboss_nvram

settings_storage:
  address: 0x1fb000
  size: 0x2000
  region: flash_primary
  placement:
    align:
      start: 0x1000
    before:
    - end

sram_primary:
  address: 0x20000000
  end_address: 0x20040000
  region: sram_primary
  size: 0x40000

Below is my mcuboot.conf file:

CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_500PPM=y
CONFIG_BOOT_MAX_IMG_SECTORS=256


I am using nRF Connect SDK v2.7.0 and Toolchain v2.7.0

  • Hi Dalvadi,

    it seems to me that your pm_static.yml is configured wrong.
    The nRF52840 has 1MB flash so the max address usable is 0xFFFFF.
    According to your pm_static your secondary partition starts at 0xFD000 and goes till 0x1EE000 which already exceeds the 1MB flash.

    May I ask how you got this pm_static?

    Kind regards
    Johannes

  • Hi Johannes,

    Thank you for your suggestion. You are correct that the secondary partition exceeds the 1MB flash limit of the nRF52840. I am using additional storage for data logging, and I also need to support DFU updates.

    Can you provide a correct pm_static.yml configuration that includes some storage space and supports DFU updates while staying within the 1MB flash limit of the nRF52840?

    Best regards,
    Dalvadi

  • Hi Dalvadi,

    in your case I think it should look something like this:

    mcuboot:
      address: 0x0
      size: 0xc000
      region: flash_primary
    
    mcuboot_pad:
      address: 0xc000
      size: 0x200
      region: flash_primary
    
    mcuboot_primary:
      address: 0xc000
      size: 0x72000
      region: flash_primary
    
    app:
      address: 0xc200
      size: 0x71E00
      region: flash_primary
    
    mcuboot_secondary:
      address: 0x7e000
      size: 0x73000
      region: flash_primary
    
    second_storage:
      address: 0xf1000
      size: 0x4000
      region: flash_primary
      placement:
        align:
          start: 0x1000
        before:
        - zboss_nvram
    
    zboss_nvram:
      address: 0xf5000
      size: 0x8000
      region: flash_primary
      placement:
        after:
        - second_storage
        align:
          start: 0x1000
    
    zboss_product_config:
      address: 0xfd000
      size: 0x1000
      region: flash_primary
      placement:
        after:
        - zboss_nvram
    
    settings_storage:
      address: 0xfe000
      size: 0x2000
      region: flash_primary
      placement:
        align:
          start: 0x1000
        before:
        - end
    
    sram_primary:
      address: 0x20000000
      end_address: 0x20040000
      region: sram_primary
      size: 0x40000

    Kind regards,
    Johannes

Related