NRF54L15 SPIS

hello,
I encountered a problem using SPIS to communicate on nrf54l15

Environment: NRF54L15, NCS2.8.0

When using SPIS for SPI communication, you must first write empty data by spi_transceive_signal (spi_slave_dev, spi_slave_cfg, &s_tx, &s_rx, p_spi_slave_done_sig) before waiting for the master to initiate communication in the thread k_poll (&async_evt, 1, K_FOREVER). Direct k_poll cannot receive instructions from mater

So in order to receive data from the master every time, you must run spi_transceive_signal to write empty data after each spi transmission. When salve actively wants to transmit data,

Method 1: Directly write data to spi_transceive_signal, and then notify the master to read, so that you cannot successfully communicate with the master.

Method 2: First notify the master to read the empty data written by spi_transceive_signal last time, then write data to spi_transceive_signal, and then notify the master to read, so that the data that the slave really wants to upload can be read.

Method 2 has one more transmission. How can we make it possible for the slave to transmit data to the master in one transmission when it wants to transmit?

  • Hi

    I'm not sure I understand what you're saying here, but it sounds to me like you're just describing how a SPI slave should work. Since it is a slave it just waits/listens to the master to give it "instructions" before doing anything. You can directly write, but then the master won't know to listen by default I think.

    Best regards,

    Simon

  • thanks,
    In other words:

    I want to know how to change the slave send buffer data before the master initiates Spi communication next time after writing the slave send buffer data in spi_transceive_signal(spi_slave_dev, spi_slave_cfg, &s_tx, &s_rx, p_spi_slave_done_sig). I tried k_poll_signal_reset(p_spi_slave_done_sig) and then calling spi_transceive_signal again to write data. I found that the program would be blocked here.

  • I think you may be right here, that the SPIS driver in NCS might be needing to have an empty buffer set when you are using spi_transceive_signal the way you are using. But maybe we can try this.

    • After the SPI driver is initialized, you can use nrfx_spis_buffers_set to set the default TX and RX buffers. This way we are high jacking the nrfx use while using the Zephyr based SPIS driver, but I think it might be safe to do so right after the init.
    • When you get a complete handler, you set the next buffers using nrfx_spis_buffers_set to set the buffers again. 

    This might help but I am unsure if I should be suggesting you to use nRFX while using the Zephyr based driver. Otherwise, if you use only Zephyr based driver, then method 2 seems to need to have that extra transmission

Related