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
  • After I change spi_3911b definition in overlay file to below:

    spi_3911b: &spi1 {
        compatible = "nordic,nrf-spi";
        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_3911b@0 {
            compatible = "spi-device";
            reg = <0>;
            spi-max-frequency = <4000000>;
        };
    };
    compiling is file now, but, I could not change SPI clock frequency in SPI config, it is always 8M HZ, how to reduce it 4M ?
Reply
  • After I change spi_3911b definition in overlay file to below:

    spi_3911b: &spi1 {
        compatible = "nordic,nrf-spi";
        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_3911b@0 {
            compatible = "spi-device";
            reg = <0>;
            spi-max-frequency = <4000000>;
        };
    };
    compiling is file now, but, I could not change SPI clock frequency in SPI config, it is always 8M HZ, how to reduce it 4M ?
Children
Related