Adafruit Feather nRF52840 Sense Not Booting with SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y, Works with Simple DFU

I am using the Adafruit Feather nRF52840 Sense with a W25Q32 external flash and MCUBoot. I can successfully read and write to external flash using NVS, and simple DFU works fine.

Issues:

  1. When I enable SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y, the device does not start.

  2. If I first flash a DFU-compatible build (without SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y), the device boots correctly.

  3. When I update via DFU to a new build with SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y, the DFU process completes successfully, but after reboot, the device does not boot.

Observations:

  • External flash (W25Q32) works fine with NVS.

  • Simple DFU works correctly if the build does not have SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y.

  • MCUBoot does not boot when SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y is enabled, whether flashed directly or updated via DFU.

Questions:

  1. Why does the device fail to start when SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y is enabled?

  2. Are there additional configurations needed for MCUBoot to work with W25Q32 external flash?

  3. Why does the device not boot after a successful DFU update using a build with SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y?

  4. How can I debug this? Are there specific MCUBoot logs, settings, or hardware checks I should look into?

  5. Is there a known issue with SB_CONFIG_PM_EXTERNAL_FLASH_MCUBOOT_SECONDARY=y on the Adafruit Feather nRF52840 Sense?

Any help or insights would be greatly appreciated!

Parents
  • Hello,

    From the error message, it looks like MCUboot still can't access the external flash.

    I'm not completely sure, but while checking the shared project overlay and mcuboot.overlay file, I noticed that mcuboot.overlay is missing the full flash node. For the application, you have defined the full flash node inside the boards folder, but this is missing in the mcuboot.overlay.

    Try defining the flash node and SPI controller in the mcuboot.overlay, just like you did in the project overlay. I tried including something like the following inside mcuboot.overlay, samplet builds fine, but I'm not sure if it throws the same error you mentioned after flashing (as I haven’t flashed it myself).

    'mcuboot.overly
    
    / {
        aliases {
            mcuboot-button0 = &button1;
            mcuboot-led0 = &led1;
        };
    
        chosen {
            nordic,pm-ext-flash = &w25q32jv;
        };
    };
    
    &spi1 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        cs-gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi1_default>;
        pinctrl-1 = <&spi1_sleep>;
        pinctrl-names = "default", "sleep";
    
        w25q32jv: w25q32jv@0 {
            compatible = "jedec,spi-nor";
            reg = <0>;
            spi-max-frequency = <40000000>;
            size = <0x200000>;
            has-dpd;
            t-enter-dpd = <3000>;
            t-exit-dpd = <30000>;
            jedec-id = [ ef 40 16 ];
        };
    };
    
    &spi1_default {
        group1 {
            psels = <NRF_PSEL(SPIM_MOSI, 0, 13)>,
                    <NRF_PSEL(SPIM_SCK, 0, 14)>,
                    <NRF_PSEL(SPIM_MISO, 0, 15)>;
        };
    };
    
    &spi1_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_MOSI, 0, 13)>,
                    <NRF_PSEL(SPIM_SCK, 0, 14)>,
                    <NRF_PSEL(SPIM_MISO, 0, 15)>;
        };
    };

    Kind Regards,

    Abhijith

  • Hi Abhijith
     

    I also tried this, but I am getting the same error. The external flash (W25Q32) works fine with NVS, so it seems to be working correctly. However, if I remove one wire from the external flash, NVS stops working. Otherwise, both read and write operations work fine.

  • Hi Dhaval, Abhijith is away so I will try to assist you.

    Can you please show how your flash0 partition looks in your mcuboot overlay file? It should look something like this

    &flash0 {
        partitions {
            compatible = "fixed-partitions";
            #address-cells = <1>;
            #size-cells = <1>;
    
            mcuboot_secondary: partition@0 {
                label = "mcuboot_secondary";
                reg = <0x00000000 0x00400000>; /* 4 MiB */
                region = "external_flash";
            };
        };
    };

    If that does not help then please enable the logs and enable boot logs so that we can get some debug info for this.

    # Logging for debug
    CONFIG_LOG=y
    CONFIG_LOG_MODE_IMMEDIATE=y
    CONFIG_LOG_BACKEND_RTT=y
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_BOOT_SERIAL_BOOT_MODE=y

  •  &flash0 {
     
    	 partitions {
    		 compatible = "fixed-partitions";
    		 #address-cells = <1>;
    		 #size-cells = <1>;
     
    		 boot_partition: partition@0 {
    			 label = "mcuboot";
    			 reg = <0x00000000 0x0000C000>;
    		 };
    		 slot0_partition: partition@c000 {
    			 label = "image-0";
    			 reg = <0x0000C000 0x00076000>;
    		 };
    		 slot1_partition: partition@82000 {
    			 label = "image-1";
    			 reg = <0x00082000 0x00076000>;
    		 };
    
             
    		 /*
    		  * The flash starting at 0x000f8000 and ending at
    		  * 0x000fffff is reserved for use by the application.
    		  */
     
    		 /*
    		  * Storage partition will be used by FCB/LittleFS/NVS
    		  * if enabled.
    		  */
    		 storage_partition: partition@f8000 {
    			 label = "storage";
    			 reg = <0x000f8000 0x00008000>;
    		 };
    	 };
     };
    This is my flash0 partition  in nrf21540dk/nrf21540dk_nrf52840.dts file.
Reply
  •  &flash0 {
     
    	 partitions {
    		 compatible = "fixed-partitions";
    		 #address-cells = <1>;
    		 #size-cells = <1>;
     
    		 boot_partition: partition@0 {
    			 label = "mcuboot";
    			 reg = <0x00000000 0x0000C000>;
    		 };
    		 slot0_partition: partition@c000 {
    			 label = "image-0";
    			 reg = <0x0000C000 0x00076000>;
    		 };
    		 slot1_partition: partition@82000 {
    			 label = "image-1";
    			 reg = <0x00082000 0x00076000>;
    		 };
    
             
    		 /*
    		  * The flash starting at 0x000f8000 and ending at
    		  * 0x000fffff is reserved for use by the application.
    		  */
     
    		 /*
    		  * Storage partition will be used by FCB/LittleFS/NVS
    		  * if enabled.
    		  */
    		 storage_partition: partition@f8000 {
    			 label = "storage";
    			 reg = <0x000f8000 0x00008000>;
    		 };
    	 };
     };
    This is my flash0 partition  in nrf21540dk/nrf21540dk_nrf52840.dts file.
Children
No Data
Related