Hello,
I wanted to create an SPI shell, similar to what is available for I²C.
I am therefore trying to create a generic SPI device in the devicetree:
sensor_spi: &spi1 { compatible = "nordic,nrf-spim"; status = "okay"; pinctrl-0 = <&spi1_default_alt>; pinctrl-1 = <&spi1_sleep_alt>; pinctrl-names = "default", "sleep"; cs-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; spi_sensor: spi-device@0 { compatible = "spi-device"; reg = <0>; spi-max-frequency = <10000000>; label = "SPI dummy"; }; }; flash_spi: &spi3 { compatible = "nordic,nrf-spim"; status = "okay"; pinctrl-0 = <&spi3_default_alt>; pinctrl-1 = <&spi3_sleep_alt>; pinctrl-names = "default", "sleep"; cs-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>; mx25r64: mx25r6435f@0 { compatible = "jedec,spi-nor"; reg = <0>; spi-max-frequency = <80000000>; label = "MX25R64"; jedec-id = [c2 28 17]; size = <67108864>; }; };
Somehow I am not able to access the label "spi_sensor":
static struct spi_config config = { .frequency = DT_PROP(DT_NODELABEL(spi_sensor), spi_max_frequency),
devicetree_unfixed.h:12312:35: error: 'DT_N_S_soc_S_peripheral_40000000_S_spi_9000_S_spi_device_0_P_spi_max_frequency' undeclared here (not in a function); did you mean 'DT_N_S_soc_S_peripheral_40000000_S_spi_b000_S_mx25r6435f_0_P_spi_max_frequency'?
If I change the label to "mx25r64" it is working, although both entries are almost the same.
I have the feeling that using compatible = "spi-device"; is somehow not permitted, but I don't really understand why, also I wasn't able to find a better 'generic device'.
Could you give me some hint why it is not working?
Thank you!