This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

SPI example for Zephyr (nRF COnnect SDK v1.6.0-rc2)

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

Parents Reply Children
  • 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

Related