Hello,
I need an example for using the spi in zephyr and how to change the pins if necessary.
Where can I find it?
Thank you
Hello,
I need an example for using the spi in zephyr and how to change the pins if necessary.
Where can I find it?
Thank you
Hello,
Yes, there are a bunch of examples from Zephyr showing the usage of the SPI interface API.
You could for instance have a look at the SPI drivers of the BM280 sample.
For changing pins you can use a devicetree overlay file.
Regards,
Markus
Hello,
Yes, there are a bunch of examples from Zephyr showing the usage of the SPI interface API.
You could for instance have a look at the SPI drivers of the BM280 sample.
For changing pins you can use a devicetree overlay file.
Regards,
Markus
HI Markus,
from bme280 i get the function to get the device and i have modified for use the spi2
of board.dts (NRF52-DK), but i have error no device found.
How am I wrong?
Thanks
const struct device *spi2_dev;
static const struct device *get_spi2_device(void)
{
const struct device *dev;
dev= DEVICE_DT_GET_ANY(arduino_spi);
if (dev == NULL) {
/* No such node, or the node does not have status "okay". */
printk("\nError: no device found.\n");
return NULL;
}
if (!device_is_ready(dev)) {
printk("\nError: Device \"%s\" is not ready; "
"check the driver initialization logs for errors.\n",
dev->name);
return NULL;
}
printk("Found device \"%s\", getting sensor data\n", dev->name);
return dev;
}
Hi Markus,
Hi Markus,
thanks for your help, but still i can't understand how to open the SPI2, using the functions you suggest. An example is available that uses these functions.
Thanks in advance.
Fausto