Hello, I'quiet new in Zephyr.
So tell me if I'm wrong.
I would like to test driver mcp23s17 present on zephyr.
I've add in .overlay file
&spi3 { label="SPI3"; status = "okay"; sck-pin = <25>; mosi-pin = <23>; miso-pin = <24>; cs-gpios = <&gpio0 22 0>; myspidevice: mcp23s17@10 { compatible="nrf9160,microship,mcp,mcp23s17"; label = "MCP23S17"; spi-max-frequency = <8000000>; reg = <10>; }; };
And now I want to initialize my driver in main file
void main(void) { #if !DT_NODE_EXISTS(DT_NODELABEL(myspidevice)) printk("whoops\n"); #else printk(DT_LABEL(DT_NODELABEL(myspidevice))"\n"); #endif struct device *dev = device_get_binding(DT_LABEL(DT_NODELABEL(myspidevice))); if (!dev) { printk("Cannot find mcp23s17!\n"); return; } }
I've also add in prj.conf
# GPIO CONFIG_GPIO=y CONFIG_GPIO_MCP23S17=y # SPI CONFIG_SPI=y CONFIG_SPI_3=y
the DT_LABEL is found but each time, I get "Cannot find mcp23s17" result.
Where can we fond sample to use DTS? And not only documentation.
thank you in advance