Can't disable CONFIG_NORDIC_QSPI_NOR in MCUBOOT

Hello DevZone,

I'm trying to run Matter over Thread demo on nRF7002DK. In fact, it's not a real 7002DK, but a simplified version. You can check the documents about this board. We gived these away to developers.

Under normal conditions, we just select `nrf7002dk_nrf5340_cpuapp` in NCS. But when I want to run Matter over Thread demo with this board, I want to select `nrf5340dk_nrf5340_cpuapp` in NCS.

I've modified the overlay and Kconfig in the application, this works well.

boards/nrf5340dk_nrf5340_cpuapp.conf:

# Matter
CONFIG_CHIP_QSPI_NOR=n
CONFIG_CHIP_SPI_NOR=y

# Zephyr
CONFIG_NORDIC_QSPI_NOR=n
CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

boards/nrf5340dk_nrf5340_cpuapp.overlay:

/*
 * Copyright (c) 2021 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

#include <zephyr/dt-bindings/ipc_service/static_vrings.h>

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

    leds {
        led_0 {
            gpios = < &gpio1 6 GPIO_ACTIVE_LOW >;
        };
        led_1 {
            gpios = < &gpio1 7 GPIO_ACTIVE_LOW >;
        };
        /delete-node/ led_2;
        /delete-node/ led_3;
    };

    aliases {
        /delete-property/ sw2;
        /delete-property/ sw3;
        /delete-property/ led2;
        /delete-property/ led3;
    };
};

/* Set IPC thread priority to the highest value to not collide with other threads. */
&ipc0 {
    zephyr,priority = <0 PRIO_COOP>;
};

/* Disable unused peripherals to reduce power consumption */
&adc {
	status = "disabled";
};
&i2c1 {
	status = "disabled";
};
&pwm0 {
	status = "disabled";
};
&spi2 {
	status = "disabled";
};
&usbd {
	status = "disabled";
};

&qspi {
    status = "disabled";
    /delete-node/ mx25r6435f@0;
};

&spi4 {
    compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
	mx25r64: mx25r6435f@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <33000000>;
		jedec-id = [c2 28 17];
		sfdp-bfp = [
			e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
			ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
			10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
			30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
		];
		size = <67108864>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <5000>;
	};
};



&pinctrl {
    spi4_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
                <NRF_PSEL(SPIM_MISO, 0, 10)>,
                <NRF_PSEL(SPIM_MOSI, 0, 9)>;
        };
    };
    
    spi4_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
                <NRF_PSEL(SPIM_MISO, 0, 10)>,
                <NRF_PSEL(SPIM_MOSI, 0, 9)>;
            low-power-enable;
        };
    };
    
};

But when I want to do the same thing in the mcuboot, the CONFIG_NORDIC_QSPI_NOR can't be set to "n".

child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.conf:

# Zephyr
CONFIG_NORDIC_QSPI_NOR=n

CONFIG_SPI_NOR=y
CONFIG_SPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

child_image/mcuboot/boards/nrf5340dk_nrf5340_cpuapp.overlay:

/*
 * Copyright (c) 2022 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

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

    leds {
        led_0 {
            gpios = < &gpio1 6 GPIO_ACTIVE_LOW >;
        };
        led_1 {
            gpios = < &gpio1 7 GPIO_ACTIVE_LOW >;
        };
        /delete-node/ led_2;
        /delete-node/ led_3;
    };

    aliases {
        /delete-property/ sw2;
        /delete-property/ sw3;
        /delete-property/ led2;
        /delete-property/ led3;
    };
};

&qspi {
    status = "disabled";
    /delete-node/ mx25r6435f@0;
};

&spi4 {
    compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
	mx25r64: mx25r6435f@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <33000000>;
		jedec-id = [c2 28 17];
		sfdp-bfp = [
			e5 20 f1 ff ff ff ff 03 44 eb 08 6b 08 3b 04 bb
			ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
			10 d8 00 ff 23 72 f5 00 82 ed 04 cc 44 83 68 44
			30 b0 30 b0 f7 c4 d5 5c 00 be 29 ff f0 d0 ff ff
		];
		size = <67108864>;
		has-dpd;
		t-enter-dpd = <10000>;
		t-exit-dpd = <5000>;
	};
};

&pinctrl {
    spi4_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
                <NRF_PSEL(SPIM_MISO, 0, 10)>,
                <NRF_PSEL(SPIM_MOSI, 0, 9)>;
        };
    };
    
    spi4_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
                <NRF_PSEL(SPIM_MISO, 0, 10)>,
                <NRF_PSEL(SPIM_MOSI, 0, 9)>;
            low-power-enable;
        };
    };
    
};

The "build/mcuboot/zephyr/.config" shows that:

The `CONFIG_SPI_NOR` was set to "y" successfully, but `CONFIG_NORDIC_QSPI_NOR` was not set to `n`.

Did I miss any configurations? Or is this a bug? I've searched all the Kconfig in NCS that will `select` this config, but still find any solution.

Best regards,

Jayant

  • Hello Jayant,

    Do you see any warning in the build log? Usually there should be a warning if a user configuration cannot be realized.

    Another thing to check in the build log is whether the child image overlay has been included correctly. This can also be checked in the nRF Connect Extension for VS Code.

    Best regards,

    Hieu


    Please be informed that our team is currently having reduced availability due to the Easter holiday. There will be some delays in our response during this time, but we will respond to you at the earliest opportunity. Our apologies for the inconvenience.

  • Hello Hieu,

    The build log says:

    warning: NORDIC_QSPI_NOR (defined at
    /home/jayant/project/ncs/v2.6.0/modules/lib/matter/config/nrfconnect/chip-
    module/Kconfig.mcuboot.defaults:77, /home/jayant/project/ncs/v2.6.0/nrf/Kconfig.nrf:99,
    drivers/flash/Kconfig.nordic_qspi_nor:4) was assigned the value 'n' but got the value 'y'. See
    http://docs.zephyrproject.org/latest/kconfig.html#CONFIG_NORDIC_QSPI_NOR and/or look up
    NORDIC_QSPI_NOR in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.

    It seems that this config is enabled by `modules/lib/matter/config/nrfconnect/chip-module/Kconfig.mcuboot.defaults:77`.

    I'm sure it's not enabled by `nrf/Kconfig.nrf:99` because I have deleted the flash device tree node on the QSPI node.

    The question is why I can't set the CONFIG_NORDIC_QSPI_NOR to `n` ?

    Best regards,

    Jayant

  • Hi Jayant,

    I haven't figured out where exactly the problem is yet, however, I know this project can successfully use SPI NOR instead of QSPI NOR.

    2451.mcuboot_smp_uart_nrf5340_spi_nor.zip

    I'm sharing this so you could also check alongside me to see where the issue is. I have looked into a few things but still couldn't figure out what the key difference is,

    Best regards,

    Hieu

  • P.s: It appears to be due to <SDK>\modules\lib\matter\config\nrfconnect\chip-module\Kconfig.mcuboot.root. This file should only impact Matter projects. I am not well versed in Kconfig enough to tell why later Kconfig overlay cannot override the configurations here though. I will investigate further for how to get around this.

  • Hi Jayant,

    As you may have seen on the Teams thread I started, our Matter team also confirms that the default value set in Kconfig.mcuboot.default is what caused the problem. It is not clear why, but it was proven that removing that line allows you to disable QSPI NOR.

    This is the link to their PR to fix the issue. You could patch the SDK with it for now: https://github.com/nrfconnect/sdk-connectedhomeip/pull/432.

    Best regards,

    Hieu

Related