External flash DFU over BLE ( SPI )

HI,

    I am using BL653dvk board(customized ). I am  following this link ( https://devzone.nordicsemi.com/f/nordic-q-a/82430/ncs-external-flash-ota-change-qspi-to-spi) and according to that i have modified my prj.conf file and overlay as well as pm_static.yml file . I am able to build it successfully . after flashing to the board BLE also got up and after sending the app_uodate.bin file through Bluetooth. It is not completely booted it seems. in between only device stopped responding. here are the logs . what might be the reason for that.

*** Booting Zephyr OS build v2.7.99-ncs1  ***
I: Starting bootloader
W: Cannot upgrade: not a compatible amount of sectors
I: Bootloader chainload address offset: 0xc000
I: Jumping to the first image slot
*** Booting Zephyr OS build v2.7.99-ncs1  ***
Starting Bluetooth Peripheral LBS example
led initialized
Button initialized
build time: May 30 2022 16:03:31
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fe8
I: data wra: 0, 0
I: SoftDevice Controller build revision:
I: 0e e7 c5 66 67 18 3c ac |...fg.<.
I: b3 d2 cc 81 a3 dc f1 c0 |........
I: c0 36 02 22             |.6."
I: No ID address. App must call settings_load()
Enable Bluetooth.
Enable Bluetooth.
Advertising successfully started
Connected
I: Swap type: test
I: Swap type: test

*** Booting Zephyr OS build v2.7.99-ncs1  ***
I: Starting bootloader
W: Cannot upgrade: not a compatible amount of sectors
I: Bootloader chainload address offset: 0xc000
I: Jumping to the first image slot
*** Booting Zephyr OS build v2.7.99-ncs1  ***
Starting Bluetooth Peripheral LBS example
led initialized
Button initialized
build time: May 30 2022 16:03:31
I: 2 Sectors of 4096 bytes
I: alloc wra: 0, fd0
I: data wra: 0, 1c
I: SoftDevice Controller build revision:
I: 0e e7 c5 66 67 18 3c ac |...fg.<.
I: b3 d2 cc 81 a3 dc f1 c0 |........
I: c0 36 02 22             |.6."
I: No ID address. App must call settings_load()
Enable Bluetooth.
Enable Bluetooth.
Advertising successfully started
Connected
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test
I: Swap type: test

The bin file which am sending has different build time from the  current build. which is easy for me to differentiate the board got updated or not.

Note -  Board has external flash of 512 KB (IS25LQ040B).

my overlay file 

&spi1 {
	compatible = "nordic,nrf-spim";
	label = "SPI_1";
	status = "okay";
	sck-pin = <41>;
	mosi-pin = <40>;
	miso-pin = <4>;

	cs-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;

	is25: is25@0 {
		compatible = "jedec,spi-nor";
		status = "okay";
		label = "IS25";
		spi-max-frequency = <8000000>;
		reg = <0>;
		jedec-id = [ 9d 40 13  ];
		size = <4194304>;
		//sfdp-bfp = [
		//    e5 20 fb ff  ff ff ff 3f  44 eb 08 6b  08 3b 04 bb
		//    fe ff ff ff  ff ff 00 ff  ff ff 44 eb  0c 20 0f 52
		//    10 d8 00 ff  d6 49 c5 00  82 df 04 e3  44 03 67 38
		//    30 b0 30 b0  f7 bd d5 5c  4a 9e 29 ff  f0 50 f9 85
		//];
	};
};

&is25 {
	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;
		slot2_partition: partition@0 {
			label = "slot2";
			reg = <0x00000000 0x0004B000>;
		};
		fallback_partition: partition@4B000 {
			label = "fallback";
			reg = <0x0004B000 0x00032000>;
		};
		veeprom_partition: partition@7D000 {
			label = "veeprom";
			reg = <0x0007D000 0x00003000>;
		};
	};
};

my prj.conf file 

# Ensure an MCUboot-compatible binary is generated.
CONFIG_NCS_SAMPLES_DEFAULTS=y

CONFIG_BT=y
CONFIG_BT_PERIPHERAL=y
CONFIG_BT_DEVICE_NAME="DFU_LE"

# Enable the LBS service
CONFIG_BT_LBS=y
CONFIG_BT_LBS_POLL_BUTTON=y
CONFIG_DK_LIBRARY=y

CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048


CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_LOG=y

CONFIG_GPIO=y

# CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

CONFIG_NORDIC_QSPI_NOR=n

CONFIG_FLASH=y
CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096
CONFIG_SPI_NRFX_RAM_BUFFER_SIZE=32 

# Enable mcumgr.
CONFIG_MCUMGR=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y

# Ensure an MCUboot-compatible binary is generated.
CONFIG_BOOTLOADER_MCUBOOT=y

# Allow for large Bluetooth data packets.
CONFIG_BT_L2CAP_TX_MTU=252
CONFIG_BT_BUF_ACL_RX_SIZE=256

# Enable the Bluetooth (unauthenticated) and shell mcumgr transports.
CONFIG_MCUMGR_SMP_BT=y
CONFIG_MCUMGR_SMP_BT_AUTHEN=n


#CONFIG_BLR_BOARD_INIT=y
# CONFIG_MCUBOOT_INDICATION_LED = y


# Some command handlers require a large stack.
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096

child_image/mcuboot/prj.conf file

CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_MAX_SKIP=0

# CONFIG_MULTITHREADING = n
#
# Copyright (c) 2021 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# In order to provide board specific configurations to the MCUboot child image
# we also need to provide a base configuration for MCUboot. This file contains
# the basic configurations needed to successfully build and run MCUboot.

# MCUboot requires a large stack size, otherwise an MPU fault will occur
CONFIG_MAIN_STACK_SIZE=10240

#CONFIG_DEBUG_OPTIMIZATIONS=y

# Enable flash operations
CONFIG_FLASH=y
CONFIG_GPIO=y

# This must be increased to accommodate the bigger images.
CONFIG_BOOT_MAX_IMG_SECTORS=128
# CONFIG_BOOT_MAX_IMG_SECTORS= 512

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_NORDIC_QSPI_NOR=n

CONFIG_SPI=y
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

# If you don't add this when setting CONFIG_SPI=y, you'll get a lot of undefined references from the nrfx spim driver
# E.G. "undefined reference to `z_impl_k_sleep'"
CONFIG_MULTITHREADING=y

# CONFIG_MCUBOOT_INDICATION_LED = y

my partition file pm_static.yml file

external_flash:
  address: 0x00000
  end_address: 0x80000
  region: external_flash
  size: 0x80000

mcuboot_secondary:
  address: 0x00000
  device: IS25
  end_address: 0x4B000
  region: external_flash
  size: 0x4B000

Regards,

Shikamaru

Parents Reply Children
No Data
Related