MCUBoot not booting application with CONFIG_BOOT_SERIAL_WAIT_FOR_DFU

Hello everyone

I am using nRF Connect SDK v2.0.2 on this project with a nRF5340.

I want to use MCUBoot to update my application (based on the central_bas project) once deployed. So far I setup MCUBoot and got it to run.

Using the default serial recovery mode where I have to press button 1 on the DK works fine. Using mcumgr I can upload new images to the nRF chip which then get booted upon reset. So far so good.

Now I want to use this configuration on a custom board where I don't have an extra GPIO pin to enable serial recovery. To fix this, I found the "CONFIG_BOOT_SERIAL_WAIT_FOR_DFU" option which states that "MCUboot waits for a prescribed duration of time to allow for DFU to be invoked". I added this and the timeout configuration to the prj.conf, but now my application doesn't boot anymore. To be clear, this is on the nRF5340DK, so there won't be missing device tree configs I suppose.

To test this I just took the central_bas project and applied the configuration in both prj.conf files of the project as well as MCUBoot (see below).

Setting "CONFIG_BOOT_SERIAL_WAIT_FOR_DFU" to "n" results in the application starting as normal, but "y" results in MCUBoot entering serial recovery mode and not leaving it after the defined timeout. Even after several minutes, long after the timeout should be over, I can still send commands via mcumgr with get detected and processed.

What did I miss here? Is it possible that there are "still alive" packets or something similar sent over the UART_0?

Best regards,

Alex

prj.conf of central_bas:

#
# Copyright (c) 2019 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#
CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=y
CONFIG_BT_CENTRAL=y
CONFIG_BT_SMP=y
CONFIG_BT_GATT_CLIENT=y
CONFIG_BT_GATT_DM=y
CONFIG_HEAP_MEM_POOL_SIZE=1024
CONFIG_BT_BAS_CLIENT=y

CONFIG_BT_SCAN=y
CONFIG_BT_SCAN_FILTER_ENABLE=y
CONFIG_BT_SCAN_UUID_CNT=1
CONFIG_BT_PRIVACY=y

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

CONFIG_DK_LIBRARY=y

### Added first-stage bootloader
CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_MCUBOOT_IMAGE_VERSION="1.0.0+1"	# maj.min.rev+build

# Some command handlers require a large stack. Important for mcumgr, would otherwise timeout
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

### From UART example ###
CONFIG_UART_ASYNC_API=y
CONFIG_NRFX_UARTE0=y
CONFIG_UART_0_ASYNC=y
CONFIG_SERIAL=y

prj.conf of mcuboot:

CONFIG_PM=n

CONFIG_MAIN_STACK_SIZE=10240
CONFIG_MBEDTLS_CFG_FILE="mcuboot-mbedtls-cfg.h"

CONFIG_BOOT_SWAP_SAVE_ENCTLV=n
CONFIG_BOOT_ENCRYPT_RSA=n
CONFIG_BOOT_ENCRYPT_EC256=n
CONFIG_BOOT_ENCRYPT_X25519=n

CONFIG_BOOT_UPGRADE_ONLY=n
CONFIG_BOOT_BOOTSTRAP=n

### mbedTLS has its own heap
# CONFIG_HEAP_MEM_POOL_SIZE is not set

### We never want Zephyr's copy of tinycrypt.  If tinycrypt is needed,
### MCUboot has its own copy in tree.
# CONFIG_TINYCRYPT is not set
# CONFIG_TINYCRYPT_ECC_DSA is not set
# CONFIG_TINYCRYPT_SHA256 is not set

CONFIG_FLASH=y
CONFIG_FPROTECT=y

### Various Zephyr boards enable features that we don't want.
# CONFIG_BT is not set
# CONFIG_BT_CTLR is not set
# CONFIG_I2C is not set

CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y # former CONFIG_MODE_MINIMAL
### Ensure Zephyr logging changes don't use more resources
CONFIG_LOG_DEFAULT_LEVEL=0
### Decrease footprint by ~4 KB in comparison to CBPRINTF_COMPLETE=y
CONFIG_CBPRINTF_NANO=y
CONFIG_NRF_RTC_TIMER_USER_CHAN_COUNT=0


### Added for serial recovery ###
CONFIG_MCUBOOT_SERIAL=y
CONFIG_BOOT_SERIAL_UART=y
CONFIG_UART_CONSOLE=n

### Enable wait for serial recovery ###
CONFIG_BOOT_SERIAL_WAIT_FOR_DFU=y
CONFIG_BOOT_SERIAL_WAIT_FOR_DFU_TIMEOUT=1000

Parents Reply Children
Related