This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

QSPI for nrf5340-DK, examples and API functions

I am working with the module nrf5340-DK. I am searching for an example to use the QSPI with the onboard external memory, could you share an example? and the other question is where is the API I must use to control the QSPI.

Parents Reply Children
  • Hi I am trying to interface QSPI with NRF5340 dk board. I am getting build errors. I have used SPI-FLASH sample and it was working fine and I am trying to change the SPI-FLASH code into a modular form for QSPI.

    Here I am attaching the overlay file:

    // To get started, press Ctrl+Space to bring up the completion menu and view the available nodes.

    // You can also use the buttons in the sidebar to perform actions on nodes.
    // Actions currently available include:

    // * Enabling / disabling the node
    // * Adding the bus to a bus
    // * Removing the node
    // * Connecting ADC channels

    // For more help, browse the DeviceTree documentation at docs.zephyrproject.org/.../index.html
    // You can also visit the nRF DeviceTree extension documentation at nrfconnect.github.io/.../nrfdevicetree.html


    // &qspi {
    //     status = "okay";
    // };
    /{
        aliases {
            flash = &mx25r64;
        };
    };


    // Configuration take from nrf5340_cpuapp_commom-pinctrl.dtsi file
    &pinctrl {

        qspi_default: qspi_default {
            group1 {
                psels = <NRF_PSEL(QSPI_IO0, 0, 13)>,
                        <NRF_PSEL(QSPI_IO1, 0, 14)>,
                        <NRF_PSEL(QSPI_IO2, 0, 15)>,
                        <NRF_PSEL(QSPI_IO3, 0, 16)>,
                        <NRF_PSEL(QSPI_SCK, 0, 17)>,
                        <NRF_PSEL(QSPI_CSN, 0, 18)>;
                nordic,drive-mode = <NRF_DRIVE_H0H1>;
                   
            };
        };

        qspi_sleep: qspi_sleep {
            group1 {
                psels = <NRF_PSEL(QSPI_IO0, 0, 13)>,
                        <NRF_PSEL(QSPI_IO1, 0, 14)>,
                        <NRF_PSEL(QSPI_IO2, 0, 15)>,
                        <NRF_PSEL(QSPI_IO3, 0, 16)>,
                        <NRF_PSEL(QSPI_SCK, 0, 17)>;
                low-power-enable;
                       
            };
            group2 {
                psels = <NRF_PSEL(QSPI_CSN, 0, 18)>;
                low-power-enable;
                bias-pull-up;
            };
        };
       
    };

    // Configuration take from nrf5340_cpuapp_commom.dtsi file
    &qspi {
        status = "okay";
        pinctrl-0 = <&qspi_default>;
        pinctrl-1 = <&qspi_sleep>;
        pinctrl-names = "default", "sleep";
        mx25r64: mx25r6435f@0 {
            compatible = "nordic,qspi-nor";
            reg = <0>;
            /* MX25R64 supports only pp and pp4io */
            writeoc = "pp4io";
            /* MX25R64 supports all readoc options */
            readoc = "read4io";
            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>;
        };
    };

    Here I am attaching the prj.conf :
    CONFIG_GPIO = y
    CONFIG_SPI_NOR = y
    CONFIG_SPI = n
    CONFIG_NORDIC_QSPI_NOR=y
    CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

    CONFIG_TRUSTED_EXECUTION_SECURE=y
    CONFIG_BUILD_WITH_TFM = n
    This is the error I am getting:
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\c57af46cb7\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/c57af46cb7/opt/bin/python.exe '-Bc:\Users\TDANAM\NRF\Flash\build' -GNinja '-Sc:\Users\TDANAM\NRF\Flash'
    And I am using v2.5.2 sdk.
    Please try to help in this.
Related