Hi,
really new to the Zephyr stuff and Nordic micros. I've been through the dev academy training examples and get how to use GPIO and I2C by getting a pointer to a device structure from the dts file.
But I just cannot work out how to do the same for an spi device!
I have used the same method as the GPIO and LED devices but get errors when I try to get a pointer to the spi device struct....
main.c
#include <zephyr/zephyr.h>
#include <drivers/gpio.h>
#include <zephyr/drivers/spi.h>
struct device *spiDev; /* SPI device pointer*/
void main(void)
{
spiDev = DEVICE_DT_GET(DT_NODELABEL(spi0));
}
in the nrf52840dk_nrf52840 dts file spi0 is defined as...
spi0: spi@40003000 {
compatible = "nordic,nrf-spi";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x40003000 0x1000>;
interrupts = <3 NRF_DEFAULT_IRQ_PRIORITY>;
max-frequency = <DT_FREQ_M(8)>;
status = "disabled";
pinctrl-0 = <&spi0_default>;
pinctrl-1 = <&spi0_sleep>;
pinctrl-names = "default", "sleep";
};
I keep getting this error..
C:\ncs\myApps\MySPI_Example1\src\main.c:15: undefined reference to `__device_dts_ord_105'
All I want to do it control a display device via spi, which I have done on other micros fairly easily in the past, so what am i doing wrong here?
I've looked at lots of the examples, including the spi bitbang one but am really confused!!
Many thanks!