nRF54l15 SPI slave not work as expected

I am trying to setup SPI00 as SPI slave on nrf54l15 but not work as expected.

My board configure is like 

&pinctrl {
    spi00_default: spi00_default {
        group1 {
            psels = <NRF_PSEL(SPIS_SCK, 2, 1)>,  /* SCK Input */
                    <NRF_PSEL(SPIS_MOSI, 2, 2)>, /* MOSI Input */
                    <NRF_PSEL(SPIS_MISO, 2, 4)>, /* MISO Output */
                    <NRF_PSEL(SPIS_CSN, 2, 5)>;  /* CS Input - Must be here! */
        };
    };
    spi00_sleep: spi00_sleep {
        group1 {
            psels = <NRF_PSEL(SPIS_SCK, 2, 1)>,  /* SCK Input */
                    <NRF_PSEL(SPIS_MOSI, 2, 2)>, /* MOSI Input */
                    <NRF_PSEL(SPIS_MISO, 2, 4)>, /* MISO Output */
                    <NRF_PSEL(SPIS_CSN, 2, 5)>;  /* CS Input - Must be here! */
        };
    };
};


&spi00 {
    status = "okay";
    compatible = "nordic,nrf-spis";
    pinctrl-0 = <&spi00_default>;
    pinctrl-1 = <&spi00_sleep>;
    pinctrl-names = "default","sleep";
    def-char = <0x00>;
    /delete-property/ rx-delay-supported;
    /delete-property/ rx-delay;
};

and c program like

#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/kernel.h>
#include <zephyr/types.h>
#include <zephyr/drivers/spi.h>

#define SPI_NODE DT_NODELABEL(spi00)
static const struct device *spi_dev = DEVICE_DT_GET(SPI_NODE);

struct spi_config spis_cfg = {
          .frequency = 0, /* Frequency is controlled entirely by the Master */
        .operation = SPI_WORD_SET(8) | SPI_OP_MODE_SLAVE,
};



int main(void)
{
	int err;
	int ret_val;
	uint8_t rx_buffer[32] = {
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89
	                        };
	uint8_t tx_buffer[32] = {
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89
	                        };


    if (!device_is_ready(spi_dev)) {
		printk("UART device not found!");
		return 0;
	}

	while (true) {
			printk("waiting for request\r\n");
		
    struct spi_buf tx_buf = { .buf = tx_buffer, .len = sizeof(tx_buffer) };
    struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };

    struct spi_buf rx_buf = { .buf = rx_buffer, .len = sizeof(rx_buffer) };
    struct spi_buf_set rx_bufs = { .buffers = &rx_buf, .count = 1 };
  		spi_transceive(spi_dev, &spis_cfg, &tx_bufs, &rx_bufs);

  		printk("spi work done\n");
				
	}
	/* return to idle thread */
	return 0;
}
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/kernel.h>
#include <zephyr/types.h>
#include <zephyr/drivers/spi.h>

#define SPI_NODE DT_NODELABEL(spi00)
static const struct device *spi_dev = DEVICE_DT_GET(SPI_NODE);

struct spi_config spis_cfg = {
          .frequency = 0, /* Frequency is controlled entirely by the Master */
        .operation = SPI_WORD_SET(8) | SPI_OP_MODE_SLAVE,
};



int main(void)
{
	int err;
	int ret_val;
	uint8_t rx_buffer[32] = {
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89
	                        };
	uint8_t tx_buffer[32] = {
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89,
	                  0xab,0xcd,0xef,0xee,0xaa,0xff,0x12,0x89
	                        };


    if (!device_is_ready(spi_dev)) {
		printk("UART device not found!");
		return 0;
	}

	while (true) {
			printk("waiting for request\r\n");
		
    struct spi_buf tx_buf = { .buf = tx_buffer, .len = sizeof(tx_buffer) };
    struct spi_buf_set tx_bufs = { .buffers = &tx_buf, .count = 1 };

    struct spi_buf rx_buf = { .buf = rx_buffer, .len = sizeof(rx_buffer) };
    struct spi_buf_set rx_bufs = { .buffers = &rx_buf, .count = 1 };
  		spi_transceive(spi_dev, &spis_cfg, &tx_bufs, &rx_bufs);

  		printk("spi work done\n");
				
	}
	/* return to idle thread */
	return 0;
}

The program intends to use nrf54L15 builtin supported SPI module as slave. Each time it receive SPI master's polling request. it should send back data to master in rx_buffer. 

I connect nRF54l15 with nrf52833 and nrf52833 works as SPI master. But nRF54l15 will hangs at "spi_transceive" forever whenever master send 32 bytes through SPI bus.

I have browse some of discussion about spi slave before. And I don't know how to address this issue. I prefer not to change pin assignment to address this because I already have manufactured small amount of hardware samples.

Related