using nrf spi flash driver

I'm trying to use the nordic spi flash driver with a w25q64jvssiq SPI NOR device.

https://github.com/nrfconnect/sdk-zephyr/tree/main/samples/drivers/spi_flash

having problems adding the correct config and overlay

prj.conf ive added

CONFIG_FLASH=y
CONFIG_SPI=y
in app.overlay ive added
spi_flash0:&spi2
{
    compatible = "nordic,nrf-spim";
    pinctrl-0 = <&spi2_default_alt>;
    pinctrl-1 = <&spi2_sleep_alt>;
    pinctrl-names = "default", "sleep";
    status = "okay";
    // cs-gpios = <&gpio0 31 GPIO_ACTIVE_LOW>;
};
spi2_default_alt: spi2_default_alt {
    group1 {
        psels = <NRF_PSEL(SPIM_MOSI, 0, 9)>,
               <NRF_PSEL(SPIM_SCK, 0, 8)>,
                <NRF_PSEL(SPIM_MISO, 0, 10)>;
    };
};
spi2_sleep_alt: spi2_sleep_alt {
    group1 {
       psels = <NRF_PSEL(SPIM_MOSI, 0, 9)>,
               <NRF_PSEL(SPIM_SCK, 0, 8)>,
               <NRF_PSEL(SPIM_MISO, 0, 10)>;
       low-power-enable;
    };
};
group1 is complaining about "Node group1 should have "compatible" property"
What am i missing here ?
Parents
  • group1 is now ok has ive change the overlay to this

    &spi0 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        pinctrl-0 = <&spi0_sleep>;
        pinctrl-1 = <&spi0_default>;
        cs-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;

        spi_flash0:spi_flash0@0 {
            compatible = "jedec,spi-nor";
            reg = <0>;
    //      irq-gpios = <&gpio0 21 0>;
            spi-max-frequency = <0x400000>;
            label = "W25Q64JV";
            jedec-id = [ 16 40 17 ];
            size = < 0x4000000 >;
        };
    };

    &pinctrl {
        spi0_sleep: spi0_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCL, 0, 19)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 20)>,
                        <NRF_PSEL(SPIM_MISO, 0, 21)>;
       
    //          low-power-enable;
            };
        };
       
        spi0_default: spi0_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCL, 0, 19)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 20)>,
                        <NRF_PSEL(SPIM_MISO, 0, 21)>;
            };  
        };  
    };
    the issue now is NRF_PSEL(SPIM_SCL019) has red squiggly line under it and is reporting  
    Unable to evaluate expression
    #define NRF_PSEL(SPIM_SCL, 0, 19) \
    ((((((0) * 32U) + (19)) & 0x7FU) << 0U) | ((NRF_FUN_SPIM_SCL & 0xFFFFU) << 16U))
     
    ????
Reply
  • group1 is now ok has ive change the overlay to this

    &spi0 {
        compatible = "nordic,nrf-spim";
        status = "okay";
        pinctrl-0 = <&spi0_sleep>;
        pinctrl-1 = <&spi0_default>;
        cs-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;

        spi_flash0:spi_flash0@0 {
            compatible = "jedec,spi-nor";
            reg = <0>;
    //      irq-gpios = <&gpio0 21 0>;
            spi-max-frequency = <0x400000>;
            label = "W25Q64JV";
            jedec-id = [ 16 40 17 ];
            size = < 0x4000000 >;
        };
    };

    &pinctrl {
        spi0_sleep: spi0_sleep {
            group1 {
                psels = <NRF_PSEL(SPIM_SCL, 0, 19)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 20)>,
                        <NRF_PSEL(SPIM_MISO, 0, 21)>;
       
    //          low-power-enable;
            };
        };
       
        spi0_default: spi0_default {
            group1 {
                psels = <NRF_PSEL(SPIM_SCL, 0, 19)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 20)>,
                        <NRF_PSEL(SPIM_MISO, 0, 21)>;
            };  
        };  
    };
    the issue now is NRF_PSEL(SPIM_SCL019) has red squiggly line under it and is reporting  
    Unable to evaluate expression
    #define NRF_PSEL(SPIM_SCL, 0, 19) \
    ((((((0) * 32U) + (19)) & 0x7FU) << 0U) | ((NRF_FUN_SPIM_SCL & 0xFFFFU) << 16U))
     
    ????
Children
Related