SPI node in overlay file

I need to add a SPI node in overlay file to support st3911b on a our board with nRF52840:

&pinctrl {
    spi_master_default: spi_master_default {
        group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 11)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 21)>,
                        <NRF_PSEL(SPIM_MISO, 0, 19)>;
        };
    };

    spi_master_sleep: spi_master_sleep {
        group1 {
                psels = <NRF_PSEL(SPIM_SCK, 0, 11)>,
                        <NRF_PSEL(SPIM_MOSI, 0, 21)>,
                        <NRF_PSEL(SPIM_MISO, 0, 19)>;
                low-power-enable;
        };
    };
};


&spi1 {
    compatible = "nordic,nrf-spim";
    status = "okay";
   
    cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
    pinctrl-0 = <&spi_master_default>;
    pinctrl-1 = <&spi_master_sleep>;
    pinctrl-names = "default", "sleep";

    spi_3911b: spi_3911b@0 {
        compatible = "spi-device";

        reg = <0>;
        #address-cells = <1>;
        #size-cells = <0>;
        spi-max-frequency = <4000000>;

        label = "SPI_3911B";
    };
};
I always received error: '__device_dts_ord_DT_N_S_soc_S_spi_40004000_S_spi_3911b_0_P_cs_gpios_IDX_0_PH_ORD' undeclared (first use in this function) during compiling.
Please help,
Mark,
Parents Reply Children
  • I made minor change in overlay file as:

    spi_3911b: &spi1 {
        compatible = "nordic,nrf-spim";
        status = "okay";

        cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi_master_default>;
        pinctrl-1 = <&spi_master_sleep>;
        pinctrl-names = "default", "sleep";

        reg_spi_3911b: spi-dev-a@0 {
           compatible = "spi-device";
            status = "okay";
            reg = <0>;
            spi-max-frequency = <4000000>;
            lable = "SPI_3911B";
        };
       
    };
Related