Hi :
Here is the initialization in C:
#define SPIS_INST_IDX 22
static nrfx_spis_t spis_inst = NRFX_SPIS_INSTANCE(SPIS_INST_IDX);
void device_spis_init(void)
{
nrfx_err_t status;
(void)status;
#if defined(__ZEPHYR__)
IRQ_CONNECT(NRFX_IRQ_NUMBER_GET(NRF_SPIS_INST_GET(SPIS_INST_IDX)), IRQ_PRIO_LOWEST, \
NRFX_SPIS_INST_HANDLER_GET(SPIS_INST_IDX), 0, 0);
#endif
nrfx_spis_config_t spis_config = NRFX_SPIS_DEFAULT_CONFIG(6,
9,
8,
10);
spis_config.mode = NRF_SPIS_MODE_3;
spis_config.def = 0xFF;
memset(m_tx_buffer_slave, 0x55, sizeof(m_tx_buffer_slave));
memset(m_rx_buffer_slave, 0xaa, sizeof(m_rx_buffer_slave));
status = nrfx_spis_init(&spis_inst, &spis_config, spis_handler, NULL);
NRFX_ASSERT(status == NRFX_SUCCESS);
status = nrfx_spis_buffers_set(&spis_inst,
m_tx_buffer_slave, 36,
m_rx_buffer_slave, 36);
NRFX_ASSERT(status == NRFX_SUCCESS);
printk("%s %d\n", __func__, status);
printk("%s success\n", __func__);
}
&spi22 {
status = "okay";
easydma-maxcnt-bits = <8>;
compatible = "nordic,nrf-spis";
max-frequency = <DT_FREQ_M(32)>;
def-char = <0x00>;
/delete-property/ rx-delay-supported;
/delete-property/ rx-delay;
cs-gpios = <&gpio2 10 0>;
pinctrl-0 = <&spi22_default>;
pinctrl-names = "default";
zephyr,deferred-init;
};
here is the prj file:
CONFIG_SPI_SLAVE=y
CONFIG_NRFX_SPIS22=y
I completed the above initialization, but I couldn't receive any data from the slave device. The callback function didn't execute. I can confirm that the wiring of the SPI master end and the I/O is correct. Could you please tell me if there are any abnormalities with this initialization?
