This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ncs external flash ota change qspi to spi

Hello,

I am using ncs1.7.1, qspi + mx25r64 external flash ota it works well, but I don't know how to change qspi to spi.

I need your help thanks

I change the parament .overlay file

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

&spi0 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	sck-pin = <28>;
	mosi-pin = <26>;
	miso-pin = <24>;
	cs-gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;

	FM25Q08B:FM25Q08B@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <0x400000>;
        label = "FM25Q08B";
        jedec-id = [ C2 20 18 ];
        size = < 0x8000000 >;
	};
};

child mcuboot.config file

#
# 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

# Set the size here so that the size of MCUBOOT_SECONDARY won't change
# if the default value changes.
CONFIG_PM_PARTITION_SIZE_MCUBOOT=0xc000

# Enable flash operations
CONFIG_FLASH=y

# # This value must match the size of the MCUboot primary partition.
CONFIG_PM_PARTITION_SIZE_MCUBOOT_SECONDARY=0xf4000

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

# log
CONFIG_LOG=y
CONFIG_LOG_MODE_IMMEDIATE=y
CONFIG_LOG_DEFAULT_LEVEL=4
CONFIG_PRINTK=y
CONFIG_LOG_MODE_MINIMAL=n
CONFIG_UART_CONSOLE=y
CONFIG_RTT_CONSOLE=n
CONFIG_CONSOLE_HANDLER=y


CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y
CONFIG_PARTITION_MANAGER_ENABLED=y

CONFIG_BOOT_UPGRADE_ONLY=y

CONFIG_PM_EXTERNAL_FLASH=y
CONFIG_PM_EXTERNAL_FLASH_DEV_NAME="FM25Q08B"
CONFIG_PM_EXTERNAL_FLASH_BASE=0x0
CONFIG_PM_EXTERNAL_FLASH_SIZE=0x8000000




I find the code at  ncs\bootloader\mcuboot\boot\zephyr\main.c I need binding the flash but I don't know how to do it. Can you help me solve this problem. Thank you.

Personally I think  JEDEC_SPI_NOR_0_LABEL and CONFIG_XTENSA is important.

Parents Reply Children
  • Test the sample below. It is built using NCS v1.7.1 and the nRF52840 DK and the secondary slot is placed in external flash. The communications to the external flash goes through SPI. I tested it on my side and it booted successfully

    8244.hello_world_spi_nor_ext_flash.zip

    I used a pm_static.yml file to set the size and address of the external flash and the secondary slot.

    Best regards,

    Simon

  • Hi

    I copy your project to ncs\zephyr\samples and then compile and burn the nrf52840dk board but it doesn't work.

    Did i do something wrong?

  • hi,

    Maybe something bad on my nrf52840dk of mx25r64, I changed to another flash,but I can't uadate my firmware.

    Below is the log information and video.

  • I also test the flash, after ota there are no data in the flash.

  • Could you try with the sample uploaded by Håkon here: https://devzone.nordicsemi.com/f/nordic-q-a/82686/fota-smp-very-slow/343080#343080 

    I was able to perform BLE DFU with qspi external flash. I first built and flashed the sample:

    • west build -b nrf52840dk_nrf52840 -p && west flash

    Then I set CONFIG_BT_DEVICE_NAME="HELLO" in /smp_svr/prj.conf and built it again:

    • west build -b nrf52840dk_nrf52840 -p 

    Then I uploaded the file smp_svr/zephyr/app_update.bin to the phone, and performed DFU using the nRF Connect Device Manager app:

    As you can see in the end of the video, the device is advertising with "HELLO", which means the update was successful. 

    By the way, this blog post may be useful: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/ncs-dfu 

    Best regards,

    Simon

    Update:

    For some reason it was not possible to play the video I uploaded, so I uploaded it again in zipped format:

    2021-12-13-12-11-15.zip

Related