Trying to do DFU on nRF5340 development kit with external flash MX66L1G

Build environment is the nRF SDK Connect for VS Code extension with ncs 2.3.0.

I am trying to accomplish DFU over UART with mcumgr serial console in which primary slot will in internal flash of the development kit and secondary slot is in external flash MX66L1G. I am using static configuration for partition region using partition manager. The sample on which I am working is ncs\v2.3.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr 

Here is my pm_static.yml file and prj.conf 

EMPTY_0:
  address: 0xf000
  end_address: 0x11000
  placement:
    before:
    - mcuboot_pad
  region: flash_primary
  size: 0x2000
app:
  address: 0x11200
  end_address: 0x101000
  region: flash_primary
  size: 0xefe00
mcuboot:
  address: 0x0
  end_address: 0xf000
  placement:
    before:
    - mcuboot_primary
  region: flash_primary
  size: 0xf000
mcuboot_pad:
  address: 0x11000
  end_address: 0x11200
  placement:
    align:
      start: 0x8000
    before:
    - mcuboot_primary_app
  region: flash_primary
  size: 0x200
mcuboot_primary_app:
  address: 0x11200
  end_address: 0x101000
  orig_span: &id002
  - app
  region: flash_primary
  size: 0xefe00
  span: *id002
mcuboot_primary:
  address: 0x11000
  end_address: 0x101000
  orig_span: &id001
  - app
  - mcuboot_pad
  region: flash_primary
  size: 0xf0000
  span: *id001
mcuboot_secondary:
  address: 0x0
  device: DT_CHOSEN(nordic_pm_ext_flash)
  end_address: 0xf0000
  region: external_flash
  share_size:
  - mcuboot_primary
  size: 0xf0000
mcuboot_secondary_app:
  address: 0x0
  end_address: 0xefe00
  orig_span: &id003
  - app
  region: external_flash
  size: 0xefe00
  span: *id003
EMPTY_1:
  address: 0xf0000
  end_address: 0x8000000
  region: external_flash
  size: 0x7f10000
sram_primary:
  address: 0x20000000
  end_address: 0x20020000
  region: sram_primary
  size: 0x20000
# Enable the shell mcumgr transport.
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y
CONFIG_MCUMGR_SMP_SHELL=y

# mcumgr-cli application doesn't accepts log in the channel it uses
CONFIG_SHELL_LOG_BACKEND=n

# Enable shell commands.
CONFIG_MCUMGR_CMD_SHELL_MGMT=y

#Enable MCUboot
CONFIG_BOOTLOADER_MCUBOOT=y

# Enable mcumgr.
CONFIG_MCUMGR=y

#Enable flash operations.
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y
CONFIG_FPROTECT=y

# Enable most core commands.
CONFIG_MCUMGR_CMD_IMG_MGMT=y

# Enable logging
CONFIG_LOG=y
CONFIG_MCUBOOT_UTIL_LOG_LEVEL_DBG=y

# Disable debug logging
CONFIG_LOG_MAX_LEVEL=4

# DRivers enabled 
CONFIG_SPI=y

#Place MCUboot secondary in external flash
CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

CONFIG_NORDIC_QSPI_NOR=y

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

CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y

I have also created mcuboot.conf and mcuboot.overlay

/* Step 3.5 - Configure button and LED for Serial Recovery */

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

These are the errors which I am facing while flashing the mcuboot

I am taking reference for DFU over UART from this link of Dev Academy Exercise 1 - DFU over UART - Nordic Developer Academy (nordicsemi.com)

Overlay file for the hardware nrf5340dk_nrf5340dk_cpuapp.overlay

 

Please help me figure out what is missing in this whole configuration and why am I getting these errors and warnings.

Parents
  • Hello Radhika,

    Have you set the external flash in both `app.overlay` and `mcuboot.overlay` as mentioned here? See this sample for reference. Could you share the entire log and overlay files? Please use the insert tab to share the log and files, as it is a bit hard to go through the screenshots.

    Kind regards,

    Abhijith

  • Yes, I have added the board.overlay in app and mcuboot.

    &qspi {
       status = "okay";
       pinctrl-0 = <&qspi_default>;
       pinctrl-1 = <&qspi_sleep>;
       pinctrl-names = "default", "sleep";
       mx66l1g: mx66l1g45g@0 {
          compatible = "nordic,qspi-nor";
          reg = <0>;
          /* MX66L1G supports only pp and pp4io */
          writeoc = "pp4io";
          /* MX66L1G supports all readoc options */
          readoc = "read4io";
          sck-frequency = <8000000>;
          label = "MX66L1G";
          jedec-id = [c2 20 1b];
          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
    		];
          size = <1073741824>;
          status = "okay";
       };
       mx25r6435f@0 {
          status = "disabled";
       };
    };
    
     /{
       chosen {
          nordic,pm-ext-flash = &mx66l1g;
       };
    };

    I tried the sample which you have mentioned, with that I am facing mcumgr issues. Like, if I run this command "mcumgr -c testDK image list" I am seeing these prints 

    mages:
     image=0 slot=0
        version: 2.0.0.0
        bootable: false
        flags:
        hash: Unavailable
    Split status: N/A (0)

    There is no display for flags: and hash: is unavailable. After this if I still go with image upload then the second image is written on the primary slot. 

    mcuboot.conf

    #
    # Copyright (c) 2022 Nordic Semiconductor
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    # STEP 2.3 - Enable logging for MCUboot
    CONFIG_LOG=y
    CONFIG_MCUBOOT_LOG_LEVEL_INF=y
    
    #STEP 3.1 - Enable Serial Recovery over UART
    CONFIG_MCUBOOT_SERIAL=y
    CONFIG_BOOT_SERIAL_UART=y
    
    # STEP 3.2 - Disable console UART, since Serial Recovery uses UART
    CONFIG_UART_CONSOLE=n
    
    # STEP 3.3 - Configure boolader to use only one slot. 
    # STEP 5.1 - Go back to two slots, as we need two for DFU from the app
    CONFIG_SINGLE_APPLICATION_SLOT=n
    
    # STEP 3.4 - Turn on a LED so we can see when Serial Recovery mode is active
    CONFIG_MCUBOOT_INDICATION_LED=y
    
    #Boot image sectors warning
    CONFIG_BOOT_MAX_IMG_SECTORS=512
    
    #Place mcuboot secondary in external flash
    #CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

Reply
  • Yes, I have added the board.overlay in app and mcuboot.

    &qspi {
       status = "okay";
       pinctrl-0 = <&qspi_default>;
       pinctrl-1 = <&qspi_sleep>;
       pinctrl-names = "default", "sleep";
       mx66l1g: mx66l1g45g@0 {
          compatible = "nordic,qspi-nor";
          reg = <0>;
          /* MX66L1G supports only pp and pp4io */
          writeoc = "pp4io";
          /* MX66L1G supports all readoc options */
          readoc = "read4io";
          sck-frequency = <8000000>;
          label = "MX66L1G";
          jedec-id = [c2 20 1b];
          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
    		];
          size = <1073741824>;
          status = "okay";
       };
       mx25r6435f@0 {
          status = "disabled";
       };
    };
    
     /{
       chosen {
          nordic,pm-ext-flash = &mx66l1g;
       };
    };

    I tried the sample which you have mentioned, with that I am facing mcumgr issues. Like, if I run this command "mcumgr -c testDK image list" I am seeing these prints 

    mages:
     image=0 slot=0
        version: 2.0.0.0
        bootable: false
        flags:
        hash: Unavailable
    Split status: N/A (0)

    There is no display for flags: and hash: is unavailable. After this if I still go with image upload then the second image is written on the primary slot. 

    mcuboot.conf

    #
    # Copyright (c) 2022 Nordic Semiconductor
    #
    # SPDX-License-Identifier: Apache-2.0
    #
    
    # STEP 2.3 - Enable logging for MCUboot
    CONFIG_LOG=y
    CONFIG_MCUBOOT_LOG_LEVEL_INF=y
    
    #STEP 3.1 - Enable Serial Recovery over UART
    CONFIG_MCUBOOT_SERIAL=y
    CONFIG_BOOT_SERIAL_UART=y
    
    # STEP 3.2 - Disable console UART, since Serial Recovery uses UART
    CONFIG_UART_CONSOLE=n
    
    # STEP 3.3 - Configure boolader to use only one slot. 
    # STEP 5.1 - Go back to two slots, as we need two for DFU from the app
    CONFIG_SINGLE_APPLICATION_SLOT=n
    
    # STEP 3.4 - Turn on a LED so we can see when Serial Recovery mode is active
    CONFIG_MCUBOOT_INDICATION_LED=y
    
    #Boot image sectors warning
    CONFIG_BOOT_MAX_IMG_SECTORS=512
    
    #Place mcuboot secondary in external flash
    #CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y

Children
  • I am struggling with mcumgr now, why is there an issue with mcumgr and how can we resolve it?

    PS C:\ncs\v2.3.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr> mcumgr -c testDK image list
    Images:
     image=0 slot=0
        version: 2.0.0.0
        bootable: false
        flags:
        hash: Unavailable
    Split status: N/A (0)
    PS C:\ncs\v2.3.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr> mcumgr -c testDK image upload build/zephyr/app_update.bin  
     72.02 KiB / 72.02 KiB [===================================================================================================================================================================================================] 100.00% 1.92 KiB/s 37s
    Done
    PS C:\ncs\v2.3.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr> mcumgr -c testDK image list
    Images:
     image=0 slot=0
        version: 1.0.0.0
        bootable: false
        flags: 
        hash: Unavailable
    Split status: N/A (0)
    PS C:\ncs\v2.3.0\zephyr\samples\subsys\mgmt\mcumgr\smp_svr>

Related