DFU not working for Nrf52840 DK using onboard external flash

Hi Team,

I want to do the firmware upgrade during bootup the system. Currently New Image is transferred from another BLE device and stored on the External Flash. During Bootup, MCUBoot has to check the Image available on External flash and update the firmware if it is valid Image. Using nrf connect SDK v2.5.0.

I have configured the Prj.conf file as 

CONFIG_SERIAL=y
CONFIG_UART_ASYNC_API=y

#Enable MCUBOOT bootloader build in the application
CONFIG_BOOTLOADER_MCUBOOT=y

CONFIG_STDOUT_CONSOLE=y
CONFIG_FLASH=y
CONFIG_SPI=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="BLE"
CONFIG_BT_DEVICE_APPEARANCE=1282

CONFIG_BT_SMP=y

CONFIG_BT_SETTINGS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
CONFIG_SETTINGS=y

CONFIG_HEAP_MEM_POOL_SIZE=2048

CONFIG_DK_LIBRARY=y
CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y
CONFIG_BT_SMP_ALLOW_UNAUTH_OVERWRITE=y

# RTC
CONFIG_NRFX_RTC2=y
CONFIG_COUNTER=y

CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_USER_PHY_UPDATE=y
CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n

CONFIG_BT_BUF_ACL_RX_SIZE=2004
CONFIG_BT_ATT_PREPARE_COUNT=2
CONFIG_BT_L2CAP_TX_BUF_COUNT=10
CONFIG_BT_L2CAP_TX_MTU=2000
CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y
CONFIG_BT_CONN_TX_MAX=10
CONFIG_BT_BUF_ACL_TX_COUNT=10
CONFIG_BT_BUF_ACL_TX_SIZE=2004

CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_PHY_2M=y
CONFIG_BT_CTLR_RX_BUFFERS=2
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=4000000

# Disable notes and warnings
CONFIG_LOG_MODE_MINIMAL=y

CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

mcuboot.conf

CONFIG_SPI_NOR=y
CONFIG_BOOT_MAX_IMG_SECTORS=256
CONFIG_BOOT_VALIDATE_SLOT0=n

CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
CONFIG_MULTITHREADING=y

nrf52849dk_nfr52840.overlay (placed same folder of proj.conf)

/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
};

py_static.yaml

EMPTY_0:
address: 0xfe000
end_address: 0x100000
placement:
after:
- settings_storage
region: flash_primary
size: 0x2000
app:
address: 0x10200
end_address: 0xfc000
region: flash_primary
size: 0xebe00
external_flash:
address: 0x0
end_address: 0x800000
region: external_flash
size: 0x800000
littlefs_storage:
address: 0x0
device: w25q64
end_address: 0x800000
filesystem: littlefs
placement:
before:
- end
region: external_flash
size: 0x800000
mcuboot:
address: 0x0
end_address: 0x10000
placement:
before:
- mcuboot_primary
region: flash_primary
size: 0x10000
mcuboot_pad:
address: 0x10000
end_address: 0x10200
placement:
align:
start: 0x4000
before:
- mcuboot_primary_app
region: flash_primary
size: 0x200
mcuboot_primary:
address: 0x10000
end_address: 0xfc000
orig_span: &id001
- app
- mcuboot_pad
region: flash_primary
size: 0xec000
span: *id001
mcuboot_primary_app:
address: 0x10200
end_address: 0xfc000
orig_span: &id002
- app
region: flash_primary
size: 0xebe00
span: *id002
mcuboot_secondary:
address: 0x1000000
device: DT_CHOSEN(nordic_pm_ext_flash)
end_address: 0x10ec000
placement:
align:
start: 0x4
region: external_flash
share_size:
- mcuboot_primary
size: 0xec000
otp:
address: 0xff8100
end_address: 0xff83fc
region: otp
size: 0x2fc
pcd_sram:
address: 0x20000000
end_address: 0x20002000
placement:
after:
- start
region: sram_primary
size: 0x2000
rpmsg_nrf53_sram:
address: 0x20070000
end_address: 0x20080000
placement:
before:
- end
region: sram_primary
size: 0x10000
settings_storage:
address: 0xfc000
end_address: 0xfe000
placement:
align:
start: 0x4000
before:
- end
region: flash_primary
size: 0x2000
sram_primary:
address: 0x20002000
end_address: 0x20070000
region: sram_primary
size: 0x6e000

Bootloader is not able to do the firmware upgrade after system reset. Following message are printed on terminal.

*** Booting nRF Connect SDK v2.5.0 ***
I: Starting bootloader
W: Failed reading sectors; BOOT_MAX_IMG_SECTORS=256 - too small?
W: Cannot upgrade: not a compatible amount of sectors
I: Bootloader chainload address offset: 0xc000

Please help to resolve the issue.

Parents Reply Children
Related