It appears that the current SDK for the nRF9160 does not support SPI Slave communication. Is this true or have I missed something? Thanks.
It appears that the current SDK for the nRF9160 does not support SPI Slave communication. Is this true or have I missed something? Thanks.
Hi,
If you mean that there is no sample for SPIS, then; you are right, there's no sample specifically for SPIS.
The drivers and port files are present in zephyr:
https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/master/drivers/spi/spi_nrfx_spis.c
To enable the module, here with enabling SPIS 3, you can add this to your prj.conf file:
# SPI CONFIG_SPI=y CONFIG_SPI_SLAVE=y CONFIG_SPI_3_NRF_SPIS=y # 2 = slave only CONFIG_SPI_3_OP_MODES=2
Note: add "CONFIG_SPI_ASYNC=y" for asynchronous SPIS operation.
And you'll also need to set which GPIOs to use and other settings, typically in your project_folder/nrf9160_pca10090ns.overlay (Note, new overlay settings!):
&spi3 { compatible = "nordic,nrf-spis"; status = "okay"; sck-pin = <10>; mosi-pin = <11>; miso-pin = <12>; csn-pin = <13>; def-char = <0x00>; };
Kind regards,
Håkon
Hi,
If you mean that there is no sample for SPIS, then; you are right, there's no sample specifically for SPIS.
The drivers and port files are present in zephyr:
https://github.com/NordicPlayground/fw-nrfconnect-zephyr/blob/master/drivers/spi/spi_nrfx_spis.c
To enable the module, here with enabling SPIS 3, you can add this to your prj.conf file:
# SPI CONFIG_SPI=y CONFIG_SPI_SLAVE=y CONFIG_SPI_3_NRF_SPIS=y # 2 = slave only CONFIG_SPI_3_OP_MODES=2
Note: add "CONFIG_SPI_ASYNC=y" for asynchronous SPIS operation.
And you'll also need to set which GPIOs to use and other settings, typically in your project_folder/nrf9160_pca10090ns.overlay (Note, new overlay settings!):
&spi3 { compatible = "nordic,nrf-spis"; status = "okay"; sck-pin = <10>; mosi-pin = <11>; miso-pin = <12>; csn-pin = <13>; def-char = <0x00>; };
Kind regards,
Håkon
dboling: I updated my answer, as I provided the incorrect overlay settings. Sorry! These settings should be enough to initialize the spis driver, but would still require application handling in order to get it fully up and running.
Sorry to intrude, is there any document explaining the syntax of the CONFIG_ statements for the prj.conf that allows us to choose the correct things? It would really help because now we all depend on somebody's answer...
Go into "menuconfig" (in SES, project -> configure nrf connect sdk project, check "show names" and "show symbols"), and you should be able to resolve the options to config strings, and also apply settings for your current build (ie: newly added configs must be transferred to prj.conf to be made persistent).
Hi,
can you please share example code of nRF9160 SPI Slave if you have?