Adding another SPI device to app overlay

Hi,

below is my app overlay, this works and is used for SPI NOR Flash.

What i need to do is add another device to this SPI bus.

Its an accelerometer LIS2DH from STM. How do it change the app overlay to accommodate this new device on the same bus, but with different CS pin.

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

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

&pinctrl {
    spi0_sleep: spi0_sleep {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 1, 4)>,
           <NRF_PSEL(SPIM_MOSI, 1, 3)>,
           <NRF_PSEL(SPIM_MISO, 1, 6)>;
   
//          low-power-enable;
        };
    };
   
    spi0_default: spi0_default {
        group1 {
            psels = <NRF_PSEL(SPIM_SCK, 1, 4)>,
           <NRF_PSEL(SPIM_MOSI, 1, 3)>,
           <NRF_PSEL(SPIM_MISO, 1, 6)>;
        };  
    };  
};
Parents Reply
  • no sure what you mean....???

    this is how i get device reference

    static const struct device *flash =
        DEVICE_DT_GET(DT_NODELABEL(spi_flash0));
     
    this is what the build reports in red
    -- Found devicetree overlay: c:/Users/IMS_DEV/Documents/vscode/cdc_acm_composite/app.overlay
    'label' is marked as deprecated in 'properties:' in C:/ncs/v2.4.0/zephyr/dts/bindings\mtd\jedec,spi-nor.yaml for node /soc/spi@40003000/spi_flash0@0.
Children
Related