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

How to Use SPI Interface in a Zephyr sample example?

Hi,

I am trying to understand how to enable SPI in blinky application provided by Nordic. My intention is to transfer data between the two Nordic development kit running blinky application over SPI. I have enabled SPI with the following details in the prj.conf file.

CONFIG_GPIO=y
CONFIG_SPI=y

CONFIG_SPI_NRFX=y
CONFIG_SPI_SLAVE=y
CONFIG_SPI_ASYNC=y
CONFIG_SPI_1=y

I see that DEVICE_INIT() in main.c and  DEVICE_AND_API_INIT(1) in spi_nrfx_spi.c do all the initialization based on the board dts file. And, I could use spi_read(), spi_write(), spi_transceive() as appropriate to send/receive data thru SPI interface.

Is my understanding correct? 

Please add if I am missing anything.

Thanks,

Ram

Related