NRF52840 SPI with NCS 2.8 and above

Hello!

I am returning to software development for a BLE Mesh project on the NRF52840 after being focused on the hardware development for several months. I see that NCS is now up to 2.9 and I am following the general Nordic recommendation to always use the latest SDK and tools.

It appears that there is a significant change in setting up the SPI on 2.8 and above. I have reviewed the Dev Academy lesson on the SPI however the example in the Dev Academy uses a sensor with a well established device driver. To use struct spi_dt_spec it appears that the SPI device driver must be included in the overlay reference to &SPI. I looked at the Dev Academy Device Driver lesson and the prospect of learning how to write a device driver seems overwhelming to me. I have been programming microcontrollers in C for more than 25 years and one reason I like SPI devices is their simplicity - send a byte, get a byte.  Having to write a device driver to do that seems unreasonable.

I can find no examples for the SPI past NCS 2.5. Before I went to 2.8 for my Mesh project I was at 2.6 and my SPI routine was working fine. Please advise me on how to use the SPI while keeping current with NCS releases.

Regards,

David Carlin

Parents Reply Children
  • Thank you Marte for the very speedy response!

    By committing to Nrf Connect / Zephyr I feel obligated to do things the Zephyr way. The example you have cited does not seem to use the same struct as the Dev Academy shows. Can Nordic Semi supply an example that:

    1. 1. Uses the current NCS 2.9 SPI API, that is to say spi_dt_spec as shown in the Dev Academy SPI exercise 

    AND

    2. Allows me to send and receive bytes to a generic SPI without writing a complete device driver for that particular SPI sensor.

    Regards, 

    David Carlin

Related