I need to communicate with an SPI device (Semtech LR1110) connected to the nordic SoC nRF5340 via its SPI peripheral.
I have the driver source code but I am not sure about the steps I need to take to integrate the driver code into zephyr.
I know that I have to create a device tree overlay file that defines the compatibilty compatible="nordic,nrf-spim" and specifies the MISO, MOSI, SCK and CS pins etc...
I am not sure whether I need the following section because I do not want to create a full-blown driver in the zephyr device tree. What else do you suggest instead?
I've read in one of the posts the following:
Drivers-wise, you essentially have two options (zephyr choice is divided into two options):
1. Use the generic Zephyr driver API
a. Hard way: Create a full-blown zephyr based driver - this is normally not done unless you plan to do a pull-request to the zephyr-rtos project.
b. Easier way: Setup the SPI instance in your application, then add the communication protocol on-top.
2. Use the nordic specific nrfx driver directly
You can use the Zephyr API to create your own driver. This includes creating Kconfig menu, device tree, and developing the sensor src and porting to use the spi.h API. This would then be a portable driver, which can theoretically run on any of the supported SPI "backends" (ie: x86, arm, xtensa, etc), but its not a straight forward process.
You also have the option to use the nrfx_spim driver directly in your application, by adding CONFIG_NRFX_SPIM=y, then adding for instance CONFIG_NRFX_SPIM1=y.
It looks like option 1b is the best way but I need more details, a step-by-step guide if possible would be greatly appreciated.