Hello,
I'm trying to use a SPIS peripheral from the NRFX library in a nRF Connect SDK 2.7.0 project. The reason for using the NRFX library is to clear a GPIO pin in the SPI ISR when the transfer is finished.
The prj.conf contains the following options (i'm using the SPIS1 peripheral):
CONFIG_SPI=y CONFIG_SPI_NRFX=y CONFIG_NRFX_SPIS1=y
The device tree overlay contains the following SPI slave peripheral:
&spi1 { compatible = "nordic,nrf-spis"; status = "disabled"; // tried "okay" but nrfx_spis_init returns NRFX_ERROR_ALREADY def-char = <0xff>; };
I followed the code in modules/hal/nordic/nrfx/samples/src/nrfx_spim_spis/advanced_non_blocking/main.c in the NCS root directory. I didn't use the line IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIS_INST_GET(SPIS_INST_IDX)...) because it didn't compile. Maybe this line isn't necessary when SPI is enabled in the prj.conf file.
The SPI is initialized with nrfx_spis_init() as follows. Then the nrfx_spis_init_check() function returns true.
nrfx_spis_config_t spis_config = { .miso_pin = 38, .mosi_pin = 37, .sck_pin = 36, .csn_pin = 35, .mode = NRF_SPIS_MODE_0, .bit_order = NRF_SPIS_BIT_ORDER_LSB_FIRST, .csn_pullup = NRF_GPIO_PIN_NOPULL, .miso_drive = NRF_GPIO_PIN_S0S1, .def = 0xFF, .orc = 0xFF, .irq_priority = 6, }; nrfx_err_t err = nrfx_spis_init(&spis, &spis_config, &nrfx_spis_event_handler, NULL);
The problem is that `nrfx_spis_buffers_set()` never returns:
err = nrfx_spis_buffers_set(&spis, m_tx_buf, m_tx_len, m_rx_buf, m_rx_len); // Stays blocked here
Would you have an idea of what could be the problem ?