nRF5340DK + MCUBOOT + Sample SMP_SRV + SPI Ext. Flash

Hi guys, 

I would like to run the sample SMP_SRV at NRF5340DK with memory mx25r64 configured as SPI   (not QSPI). 

What are the necessary changes? 

I tried build an overlay like this: 

&qspi {
    status = "disabled";
};

&spi4 {
    compatible = "nordic,nrf-spim";
    status = "okay";
        cs-gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
    pinctrl-0 = <&spi4_default>;
    pinctrl-1 = <&spi4_sleep>;
    pinctrl-names = "default", "sleep";
    mx25r64over: mx25r6435f@0 {
        compatible = "nordic,nrf-spim";
        reg = <0>;
        sck-frequency = <8000000>;
        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 = <35000>;
    };
};


&pinctrl {
    spi4_default: spi4_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                <NRF_PSEL(SPIM_MISO, 0, 13)>,
                <NRF_PSEL(SPIM_MOSI, 1, 14)>;
        };
    };

    spi4_sleep: spi4_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                <NRF_PSEL(SPIM_MISO, 0, 13)>,
                <NRF_PSEL(SPIM_MOSI, 1, 14)>;
            low-power-enable;
        };
    };
};
Parents
  • Hi, 

    Any special reason to use SPI instead of QSPI?

    What NCS version are you using?

    Regards,
    Amanda H.

  • Hi Amanda.

    I'm using ncs 2.6.1. 

    Because my customized board has only SPI.

    This SPI shared to some sensors and the external memory. 

    The main target is to do FOTA using this external memory. 

    However I could'nt put the smp_srv sample to work when the memory has SPI enabled. 

    I'm trying to do all tests using DK and after that I will do the portability to my board. 

     

    Regards.

    Marcelo F.

  • Hi, 

    The nrf5340dk_nrf5340_cpuapp.overlay should look like this 

    /*
     * Copyright (c) 2021 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    /delete-node/ &mx25r64;
    / {
    	/* Configure the partition manager to use the mx25r64 external flash memory. */
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    	};
    };
    
    &qspi {
        status = "disabled";
    };
    
    &spi4 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	pinctrl-0 = <&spi4_default>;
    	pinctrl-1 = <&spi4_sleep>;
    	pinctrl-names = "default", "sleep";
    	cs-gpios = <&gpio0 18 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 = <35000>;
    	};
    };
    
    
    &pinctrl {
        spi4_default: spi4_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                    <NRF_PSEL(SPIM_MISO, 0, 14)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 13)>;
            };
        };
    
        spi4_sleep: spi4_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                    <NRF_PSEL(SPIM_MISO, 0, 14)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 13)>;
                low-power-enable;
            };
        };
    };

    Here is the smp_svr_nRF5340DK_spi.7z which supports nRF5340DK external flash via SPI. 

    Beware that this code/configuration is not fully tested or qualified and should be considered provided “as-is”. Please test it with your application and let me know if you find any issues.

    -Amanda H.

Reply
  • Hi, 

    The nrf5340dk_nrf5340_cpuapp.overlay should look like this 

    /*
     * Copyright (c) 2021 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */
    /delete-node/ &mx25r64;
    / {
    	/* Configure the partition manager to use the mx25r64 external flash memory. */
    	chosen {
    		nordic,pm-ext-flash = &mx25r64;
    	};
    };
    
    &qspi {
        status = "disabled";
    };
    
    &spi4 {
    	compatible = "nordic,nrf-spim";
    	status = "okay";
    	pinctrl-0 = <&spi4_default>;
    	pinctrl-1 = <&spi4_sleep>;
    	pinctrl-names = "default", "sleep";
    	cs-gpios = <&gpio0 18 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 = <35000>;
    	};
    };
    
    
    &pinctrl {
        spi4_default: spi4_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                    <NRF_PSEL(SPIM_MISO, 0, 14)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 13)>;
            };
        };
    
        spi4_sleep: spi4_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 17)>,
                    <NRF_PSEL(SPIM_MISO, 0, 14)>,
                    <NRF_PSEL(SPIM_MOSI, 0, 13)>;
                low-power-enable;
            };
        };
    };

    Here is the smp_svr_nRF5340DK_spi.7z which supports nRF5340DK external flash via SPI. 

    Beware that this code/configuration is not fully tested or qualified and should be considered provided “as-is”. Please test it with your application and let me know if you find any issues.

    -Amanda H.

Children
Related