Hello, I am developing my custom board using Thingy53 as a reference design. I am trying to achieve DFU from application using external flash for the secondary image and upload new image via USB CDC ACM. So far, I have been following the two tutorials from nrf academy on using external flash and USB for DFU. The AuTerm could successfully identify the serial port, but when I try to get the current image, AuTerm only reports Image 1 -> Slot 1 -> with the image state Bootable, neither Active nor Confirmed, which is different from the tutorial. I am using ncs 3.0.2
On my device end, I am using RTT terminal to get the following log information when I try to get the current images:
[00:00:28.469,482] <inf> usbd_cdc_acm:
06 09 41 41 73 49 41 41 41 42 41 41 45 41 41 4b |..AAsIAA ABAAEAAK
43 76 41 51 3d 3d 0a |CvAQ==.
[00:00:28.469,573] <inf> usbd_cdc_acm: UART dev 0x5090c size 32 length 23
[00:00:28.470,031] <inf> mcuboot_util: Image index: 0, Swap type: none
[00:00:28.470,550] <inf> mcuboot_util: Image index: 1, Swap type: none
[00:00:28.470,550] <err> mcumgr_img_grp: Failed to open flash area ID 1: -2
From a post in this forum I understand this error means I am trying to open a flash area that does not exist. I am currently stucked here.
I attach my sysbuild.conf here:
SB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=n SB_CONFIG_BOOTLOADER_MCUBOOT=y SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y SB_CONFIG_SECURE_BOOT_NETCORE=y SB_CONFIG_MCUBOOT_UPDATEABLE_IMAGES=2 SB_CONFIG_NETCORE_APP_UPDATE=y SB_CONFIG_MCUBOOT_NRF53_MULTI_IMAGE_UPDATE=y SB_CONFIG_MCUBOOT_MODE_OVERWRITE_ONLY=y SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y
The mcuboot.overlay and mcuboot.conf:
&mx25r64 {
status = "okay";
};
/ {
chosen {
nordic,pm-ext-flash = &mx25r64;
};
}; CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_SYSTEM_CLOCK_NO_WAIT=y CONFIG_PM=n CONFIG_MAIN_STACK_SIZE=10240 CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h" CONFIG_BOOT_MAX_IMG_SECTORS=2048 CONFIG_BOOT_SIGNATURE_TYPE_RSA=y # Flash CONFIG_FLASH=y CONFIG_BOOT_ERASE_PROGRESSIVELY=y CONFIG_SOC_FLASH_NRF_EMULATE_ONE_BYTE_WRITE_ACCESS=y CONFIG_FPROTECT=y # Serial CONFIG_SERIAL=y CONFIG_UART_LINE_CTRL=y # MCUBoot serial CONFIG_GPIO=y CONFIG_GPIO_NRFX_INTERRUPT=n CONFIG_MCUBOOT_SERIAL=n CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y CONFIG_BOOT_SERIAL_CDC_ACM=y # Required by QSPI CONFIG_NORDIC_QSPI_NOR=y CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096 CONFIG_NORDIC_QSPI_NOR_STACK_WRITE_BUFFER_SIZE=16 # Required by USB and QSPI CONFIG_MULTITHREADING=y # USB CONFIG_BOARD_SERIAL_BACKEND_CDC_ACM=n CONFIG_USB_DEVICE_REMOTE_WAKEUP=n CONFIG_USB_DEVICE_MANUFACTURER="Nordic Semiconductor ASA" CONFIG_USB_DEVICE_PRODUCT="Bootloader Torus53" CONFIG_USB_DEVICE_VID=0x1915 CONFIG_USB_DEVICE_PID=0x5300 CONFIG_USB_CDC_ACM=y # Decrease memory footprint CONFIG_CBPRINTF_NANO=y CONFIG_TIMESLICING=n CONFIG_BOOT_BANNER=n CONFIG_NCS_BOOT_BANNER=n CONFIG_CONSOLE=n CONFIG_CONSOLE_HANDLER=n CONFIG_UART_CONSOLE=n CONFIG_USE_SEGGER_RTT=n CONFIG_LOG=n CONFIG_ERRNO=n CONFIG_PRINTK=n CONFIG_RESET_ON_FATAL_ERROR=n CONFIG_SPI=n CONFIG_I2C=n CONFIG_UART_NRFX=n # The following configurations are required to support simultaneous multi image update CONFIG_PCD_APP=y CONFIG_UPDATEABLE_IMAGE_NUMBER=2 CONFIG_BOOT_UPGRADE_ONLY=y # The network core cannot access external flash directly. The flash simulator must be used to # provide a memory region that is used to forward the new firmware to the network core. CONFIG_FLASH_SIMULATOR=y CONFIG_FLASH_SIMULATOR_DOUBLE_WRITES=y CONFIG_FLASH_SIMULATOR_STATS=n # Enable custom command to erase settings partition. CONFIG_ENABLE_MGMT_PERUSER=y CONFIG_BOOT_MGMT_CUSTOM_STORAGE_ERASE=y
We used the partition manager to manage the partition for the external flash:
app:
address: 0x10200
region: flash_primary
size: 0xdfe00
mcuboot:
address: 0x0
region: flash_primary
size: 0x10000
mcuboot_pad:
address: 0x10000
region: flash_primary
size: 0x200
mcuboot_primary:
address: 0x10000
orig_span: &id001
- mcuboot_pad
- app
region: flash_primary
size: 0xe0000
span: *id001
mcuboot_primary_app:
address: 0x10200
orig_span: &id002
- app
region: flash_primary
size: 0xdfe00
span: *id002
settings_storage:
address: 0xf0000
region: flash_primary
size: 0x10000
mcuboot_primary_1:
address: 0x0
size: 0x40000
device: flash_ctrl
region: ram_flash
mcuboot_secondary:
address: 0x00000
size: 0xe0000
device: MX25R64
region: external_flash
mcuboot_secondary_1:
address: 0xe0000
size: 0x40000
device: MX25R64
region: external_flash
littlefs_storage:
region: external_flash
device: MX25R64
address: 0x120000
size: 0x6e0000
label: "lfs_storage"
affiliation: disk
extra_params:
disk_cache_size: 0x1000
disk_name: NOR
disk_read_only: 0x0
disk_sector_size: 0x200
pcd_sram:
address: 0x20000000
size: 0x2000
region: sram_primary
And finally we have the devicetree file including this:
chosen {
zephyr,uart-mcumgr = &cdc_acm_uart0;
zephyr,bt-hci-ipc = &ipc0;
zephyr,bt-hci = &bt_hci_ipc0;
nordic,pm-ext-flash = &mx25r64;
};
Measurement Taken So Far:
1. I have added the SB_CONFIG_PM_OVERRIDE_EXTERNAL_DRIVER_CHECK=y in my sysbuild.conf.
2. I have followed the tutorial here on simultaneous update and added those configurations.
Previously, when we are using USB DFU class together with dfu-util, the DFU work quite well.
Can anyone help with this issue?
Many thanks