I apologize if this has been asked in a different way but I have come across several older threads that seem outdated and was hoping for the new "best practices" for the current release of the nRF Connect SDK (v1.2.0) at the time of this writing.
I am trying to communicate with a "generic" SPI device. Unfortunately this is not a device already included in the Zephyr base.
Reading through the Zephyr documentation it seems that I must:
1. Write a device tree overlay compatible with "nordic,nrf-spim" that specifies the MISO, MOSI, and SCK pins
2. Add a child node compatible with "spi-device" that has a reg property equal to the pin I am using as CS pin (although there is some confusion here because there is also a property in the spi-controller device tree binding that specifies a "cs-gpios" and it seems that there is redundancy between this property and the "reg" property of the child node for the slave device)
3. Include a library that is aware of these device tree configurations
Currently my devicetree overlay file looks like this:
&spi0 { compatible = "nordic,nrf-spim"; status = "okay"; sck-pin = <25>; mosi-pin = <23>; miso-pin = <24>; rhd2132@22 { compatible = "spi-device"; reg = <22> spi-max-frequency = <24000000> label = "RHD2132" }; };
Digging through the documentation it appears that there used to be a nordic driver for SPI devices in the nRF5 SDKs, but I guess that is no longer true in the nRF Connect SDK. It also looks like that driver did not rely on the devicetree system so all the pin configurations happen as #DEFINE's in the application code.
Instead it now appears that there is a driver located at <SDK_DIR>/zephyr/drivers/spi/spi_nrfx_spim.c.
Is this the appropriate driver to use. If so could you point me in the direction of the documentation for this driver and/or and example of it being used including the devicetree overlay file necessary? I assume I need to use this one if I want to take advantage of the DMA features of the nrf devices.
Again, I apologize for the confusion I think I am getting tripped up in the change from nRF5 to nRF Connect SDK and want to use the "most" supported method of communicating with SPI devices on nRF chips.