Hi all,
I am using a nRF52840-DK as SPI slave with a MSP430 as host SPI master for a nRF8001 replacement application.
As I am absolutely not familiar with high level functions (threading, etc.) used within zephyr\samples\bluetooth\hci_spi\, I would start with a simple simulation of nRF8001 behaviour.
Thus I want to manage NREQ (CSN) and NRDY lines.
I set SPI slave driver through prj.conf
# Common SPI driver CONFIG_SPI=y # SPI hardware bus CONFIG_SPI_SLAVE=y # SPI slave support [EXP] #CONFIG_SPI_ASYNC=y # to use later... # Zephyr SPI driver #CONFIG_SPI_2=y #CONFIG_SPI_2_OP_MODES=2 # Nordic SPI driver CONFIG_NRFX_SPIS=y # Not needed here as overlay specifies compatible = "nordic,nrf-spis" ? CONFIG_NRFX_SPIS2=y # Not needed here as overlay specifies compatible = "nordic,nrf-spis" ?
and overlay
&spi2 { compatible = "nordic,nrf-spis"; #address-cells = <1>; #size-cells = <0>; reg = <0x40023000 0x1000>; interrupts = <35 1>; /* correspond to peripheral ID (PS 4.2.4) */ status = "okay"; label = "SPI_2"; sck-pin = <36>; mosi-pin = <37>; miso-pin = <38>; csn-pin = <35>; /* depend on SPIS */ def-char = <0xff>; /* depend on SPIS */ };
At this point I want to read NREQ (CSN) logical level to set NRDY active (low) and call spi_transceive().
I tried gpio_pin_get(dev_spi, 35) but it returns invalid parameters error since dev_spi is not a gpio instance, I guess.
I read that there is no way to get event when CSN goes low here ...
If the above is still true, what would be the simplest configuration to catch CSN event ?
If there is no way, can I use the SPI driver interrupt ? How this information "interrupts = <35 1>" should be used ?
Thank you.
Development setup:
- Windows 10
- nRF Connect SDK 1.4.0
- SES V5.10d
- PCA10056