OpenThread dataset lost after DFU

Hi,

I added MCUboot and SMP BT Service to the OpenThread CLI routine to implement the device firmware upgrade function.

I found that after DFU is completed, the Thread activity data set will be lost, in fact, all the data in Settings NVS will be lost.

SDK:ncs 2.9.0

board:NRF52840DK-NRF52840

The project configuration is as follows:

sysbuild.conf

# MCUboot
SB_CONFIG_BOOTLOADER_MCUBOOT=y

# MCUboot should use external flash
SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

SB_CONFIG_BOOT_SIGNATURE_TYPE_NONE=y

prj.conf

CONFIG_NCS_BOOT_BANNER=n
CONFIG_BOOT_BANNER=n

CONFIG_NORDIC_QSPI_NOR=y

# Network shell
CONFIG_SHELL=y
CONFIG_OPENTHREAD_SHELL=y
CONFIG_SHELL_ARGC_MAX=26
CONFIG_SHELL_CMD_BUFF_SIZE=416

# Increase Settings storage size
CONFIG_PM_PARTITION_SIZE_SETTINGS_STORAGE=0x8000

# Enable OpenThread features set
CONFIG_OPENTHREAD_NORDIC_LIBRARY_MASTER=y

CONFIG_NET_L2_OPENTHREAD=y

# Generic networking options
CONFIG_NETWORKING=y

# Enable Zephyr logging
CONFIG_LOG=y

# Increase the default RX stack size
CONFIG_IEEE802154_NRF5_RX_STACK_SIZE=832

# Use separate thread for logging
CONFIG_LOG_MODE_DEFERRED=y

# Enable OpenThread logging
CONFIG_OPENTHREAD_DEBUG=y
# Option for configuring log level in OpenThread
CONFIG_OPENTHREAD_LOG_LEVEL_INFO=y

# Enable RTT logging backend
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y

# Disable UART logging backend
CONFIG_LOG_BACKEND_UART=n

# augment system workqueue stack size
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2144

# Enable and configure Bluetooth LE
CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="device"
CONFIG_BT_DEVICE_APPEARANCE=833

# Enable FOTA over Bluetooth LE
CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y

sysbuild/mcuboot.conf

# Enable logging for MCUboot
CONFIG_LOG=y

# Turn on a LED so we can see when Serial Recovery mode is active
CONFIG_MCUBOOT_INDICATION_LED=n

# 
CONFIG_NORDIC_QSPI_NOR=y

# Increase number of sectors
# This is 512 for the nRF54L15 but can be smaller for other chips
# This configuration should match the largest image that you support. 
# 128*4k = 512k. If your images are larger, you should adjust this value. It is typically 256 for a 1MB flash device, such as nRF52840.
CONFIG_BOOT_MAX_IMG_SECTORS=512

CONFIG_NCS_BOOT_BANNER=n
CONFIG_BOOT_BANNER=n

# Enable RTT logging backend
CONFIG_USE_SEGGER_RTT=y
CONFIG_LOG_BACKEND_RTT=y

# Disable UART logging backend
CONFIG_LOG_BACKEND_UART=n

sysbuild/mcuboot.overlay

/ {
  aliases {
		mcuboot-button0 = &button1;
		mcuboot-led0 = &led1;
  };
};

/* Add external flash to MCUboot */
&mx25r64 {
	status = "okay";
};

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

boards/nrf52840dk_nrf52840.overlay

/* Copyright (c) 2020 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

&uart0 {
	status = "okay";
	hw-flow-control;
};

/* Add external flash to application */
&mx25r64 {
	status = "okay";
};

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

/ {
	/*
	* In some default configurations within the nRF Connect SDK,
	* e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell.
	* This devicetree overlay ensures that default is overridden wherever it
	* is set, as this application uses the RNG node for entropy exclusively.
	*/
	chosen {
		zephyr,entropy = &rng;
	};
};

What causes data loss?

Parents
  • Hi Quay,

    Which DFU app are you using? This issue maybe related to the "Erase App Settings" option in your apps.

    For example, by default, "Erase App Settings" is turned on in the nRF Connect App. You need to turn it off.

    Below is the location of this switch in the nRF Connect App (iOS version):

    If you do not need the "Erase App Settings" function via your mobile app, you can also disable support for it by setting CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=n 

    Best Regards,

    Jesse

Reply
  • Hi Quay,

    Which DFU app are you using? This issue maybe related to the "Erase App Settings" option in your apps.

    For example, by default, "Erase App Settings" is turned on in the nRF Connect App. You need to turn it off.

    Below is the location of this switch in the nRF Connect App (iOS version):

    If you do not need the "Erase App Settings" function via your mobile app, you can also disable support for it by setting CONFIG_MCUMGR_GRP_ZBASIC_STORAGE_ERASE=n 

    Best Regards,

    Jesse

Children
Related