Zephyr or NRF SPI Driver

Hello,

The NRF world is still totally new to me and I'm currently working my way into it for a project.

I use the nRF Connect SDK. I use the SPI interface on an nRF52 to receive BiSS from an encoder. In the first step, I used the Zephyr SPI API after an example. This one causes me several problems, especially when debugging. I guess the Zephyr SPI uses bitbang. Do I see it right that I can also use a NRFX_SPIM driver instead? Does this offer more features than the Zephyr driver? How I can change?

Parents
  • Hi,

    How did you configure your project?

    Zephyr does have a bitbang SPI driver, but the default should be the "normal" SPI driver which is based on our nrfx driver.

    We have an old guide that amongst other things explains how the Zephyr drivers are built up:  nRF Connect SDK Tutorial series - Part 0 | NCS v1.5.0 (part 3 is the one talking about the drivers)

    The guide is written for a quite old version of the nRF Connect SDK, so not everything will work in the newer versions, but the concepts should still be the same.

    A more recent sample on how to use Zephyr's SPI driver, from another of my colleagues, can be found here: https://github.com/too1/ncs-spi-master-slave-example

    Do I see it right that I can also use a NRFX_SPIM driver instead?

    Yes, you can use the nrfx driver directly. See zephyr\samples\boards\nrf\nrfx for a sample on how to use the nrfx drivers directly. For a sample showing how to use the nrfx SPIM driver, you can look at modules\hal\nordic\nrfx\samples\src\nrfx_spim.

    Does this offer more features than the Zephyr driver?

    Using the nrfx drivers can give you a bit more low level control, and will let you use DMA and PPI more properly.

    Best regards,

    Didrik

Reply
  • Hi,

    How did you configure your project?

    Zephyr does have a bitbang SPI driver, but the default should be the "normal" SPI driver which is based on our nrfx driver.

    We have an old guide that amongst other things explains how the Zephyr drivers are built up:  nRF Connect SDK Tutorial series - Part 0 | NCS v1.5.0 (part 3 is the one talking about the drivers)

    The guide is written for a quite old version of the nRF Connect SDK, so not everything will work in the newer versions, but the concepts should still be the same.

    A more recent sample on how to use Zephyr's SPI driver, from another of my colleagues, can be found here: https://github.com/too1/ncs-spi-master-slave-example

    Do I see it right that I can also use a NRFX_SPIM driver instead?

    Yes, you can use the nrfx driver directly. See zephyr\samples\boards\nrf\nrfx for a sample on how to use the nrfx drivers directly. For a sample showing how to use the nrfx SPIM driver, you can look at modules\hal\nordic\nrfx\samples\src\nrfx_spim.

    Does this offer more features than the Zephyr driver?

    Using the nrfx drivers can give you a bit more low level control, and will let you use DMA and PPI more properly.

    Best regards,

    Didrik

Children
Related