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
  • I created a sample earlier where the nRF9160 DK communicated with the onboard external flash using SPI. Take a look at that and use it as a reference:

    https://github.com/simon-iversen/sdk-nrf/blob/ext_flash_mcuboot_91dk/samples/nrf9160/http_update/application_update/prj.conf

    Be aware that the external flash DT configuration is done by  default in the nRF9160 DK board folder:

    https://github.com/nrfconnect/sdk-zephyr/blob/v2.6.99-ncs1/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_common_0_14_0.dtsi#L42-L65

    If this didn't help, please get back to me and I'll take a closer look at it.

    Best regards,

    Simon

  • Hi, 

    Thanks for your response, I have tryed it but it doesn't work.

    Below is my config.

    ncs: ncs1.7.1

    board: nrf52840dk 

    3730.ota.zip

  • Hi

    Thank you for you response.qspi + mx25r64 external flash ota it works well,but I need spi + mx25r64.

    I will continue to implement this method, once successful, I will share my method and joy with you. 

    Thank you.

  • Август said:
    Thank you for you response.qspi + mx25r64 external flash ota it works well,but I need spi + mx25r64.

    Ah, sorry. I totally forgot that you used SPI (even though that was the main topic of this issueFace palm).

    Август said:
    I will continue to implement this method, once successful, I will share my method and joy with you. 

    Sounds good. Use DFU over Bluetooth and the sample uploaded in my last reply as guidance on how to implement BLE DFU. If you don't get it to work please tell me and I'll look into it.

    Best regards,

    Simon

  • hi

    I have tried it but it can't work, personally I think we should change spm 

    img_mgmt_impl_write_image_data and mcuboot.
    Hope you can find another simple way.
    Thank you.
  • Hello,

    I'll look into this today and see if I can provide you with a working example

  • Could you try with this sample

    1207.hello_world_spi_nor_ext_flash.zip

    I just tested it with NCS v1.7.1 and the nRF52840dk_nrf52840 and followed these steps: https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu#ble_testing

    The DFU update was successful for me

    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Starting Bluetooth Peripheral LBS example
    build time: Dec 28 2021 13:21:47
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 1c
    I: SoftDevice Controller build revision: 
    I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
    I: 9d d3 a2 95 88 f6 30 0a |......0.
    I: 7f 53 49 fd             |.SI.    
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Swap type: none
    I: Swap type: none
    I: Swap type: none
    I: Swap type: none
    I: Erased 0x33000 bytes of image slot
    I: Erased 0x1000 bytes of image slot trailer
    I: Swap type: none
    I: Swap type: test
    I: Swap type: test
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: test
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Starting Bluetooth Peripheral LBS example
    build time: Dec 28 2021 13:30:44
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 1c
    I: SoftDevice Controller build revision: 
    I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
    I: 9d d3 a2 95 88 f6 30 0a |......0.
    I: 7f 53 49 fd             |.SI.    
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Swap type: revert
    I: Swap type: revert
    I: Swap type: none
    I: Swap type: none

Reply
  • Could you try with this sample

    1207.hello_world_spi_nor_ext_flash.zip

    I just tested it with NCS v1.7.1 and the nRF52840dk_nrf52840 and followed these steps: https://devzone.nordicsemi.com/guides/nrf-connect-sdk-guides/b/software/posts/ncs-dfu#ble_testing

    The DFU update was successful for me

    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: none
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Starting Bluetooth Peripheral LBS example
    build time: Dec 28 2021 13:21:47
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 1c
    I: SoftDevice Controller build revision: 
    I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
    I: 9d d3 a2 95 88 f6 30 0a |......0.
    I: 7f 53 49 fd             |.SI.    
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Swap type: none
    I: Swap type: none
    I: Swap type: none
    I: Swap type: none
    I: Erased 0x33000 bytes of image slot
    I: Erased 0x1000 bytes of image slot trailer
    I: Swap type: none
    I: Swap type: test
    I: Swap type: test
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    I: Starting bootloader
    I: Primary image: magic=good, swap_type=0x2, copy_done=0x1, image_ok=0x1
    I: Secondary image: magic=good, swap_type=0x2, copy_done=0x3, image_ok=0x3
    I: Boot source: none
    I: Swap type: test
    I: Bootloader chainload address offset: 0xc000
    *** Booting Zephyr OS build v2.6.99-ncs1-1  ***
    Starting Bluetooth Peripheral LBS example
    build time: Dec 28 2021 13:30:44
    I: 2 Sectors of 4096 bytes
    I: alloc wra: 0, fd0
    I: data wra: 0, 1c
    I: SoftDevice Controller build revision: 
    I: 3f 47 70 8e 81 95 4e 86 |?Gp...N.
    I: 9d d3 a2 95 88 f6 30 0a |......0.
    I: 7f 53 49 fd             |.SI.    
    I: No ID address. App must call settings_load()
    Bluetooth initialized
    Advertising successfully started
    Connected
    I: Swap type: revert
    I: Swap type: revert
    I: Swap type: none
    I: Swap type: none

Children
Related