<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Question: About SPIS of nRF54L15-DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/117571/question-about-spis-of-nrf54l15-dk</link><description>I am trying SPI Master/Slave communication between two nRF54L15-DK boards, using the nRF Connect SDK v2.8.0 and nRF54L15-DK 0.9.1 and 0.8.1. However, it seems that the SPIS (SPI Slave) is not working. I would appreciate your help. 
 For SPIM (SPI Master</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 06 Feb 2025 01:09:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/117571/question-about-spis-of-nrf54l15-dk" /><item><title>RE: Question: About SPIS of nRF54L15-DK</title><link>https://devzone.nordicsemi.com/thread/521645?ContentTypeID=1</link><pubDate>Thu, 06 Feb 2025 01:09:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7846999-d2d5-4b50-b19d-87f43cff6f04</guid><dc:creator>Kenta</dc:creator><description>&lt;p&gt;Hi, Ivan.&lt;/p&gt;
&lt;p&gt;I wrote the SPIS code like this:&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/*
 * Copyright (c) 2016 Intel Corporation
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include &amp;lt;zephyr/kernel.h&amp;gt;
#include &amp;lt;zephyr/device.h&amp;gt;
#include &amp;lt;zephyr/devicetree.h&amp;gt;
#include &amp;lt;zephyr/drivers/gpio.h&amp;gt;
#include &amp;lt;zephyr/drivers/spi.h&amp;gt;


#define MY_SPI_SLAVE  DT_NODELABEL(spi00)

// SPIS functionality
const struct device *spis_dev;
static struct k_poll_signal spi_slave_done_sig = K_POLL_SIGNAL_INITIALIZER(spi_slave_done_sig);

// .operation = SPI_TRANSFER_MSB | SPI_WORD_SET(8), // spi mode 0
// .operation = SPI_TRANSFER_MSB | SPI_WORD_SET(8) | SPI_MODE_CPHA, // spi mode 1
// .operation = SPI_TRANSFER_MSB | SPI_WORD_SET(8) | SPI_MODE_CPOL, // spi mode 2
// .operation = SPI_TRANSFER_MSB | SPI_WORD_SET(8) | SPI_MODE_CPOL | SPI_MODE_CPHA, // spi mode 3

static const struct spi_config spi_slave_cfg = {
	.operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB | SPI_OP_MODE_SLAVE,
	.frequency = 4000000,
	.slave = 1,
};

static void spi_slave_init(void)
{
	spi_slave_dev = DEVICE_DT_GET(MY_SPI_SLAVE);
	if(!device_is_ready(spi_slave_dev)) {
		printk(&amp;quot;SPI slave device not ready!\n&amp;quot;);
	}
}

static uint8_t slave_tx_buffer[10];
static uint8_t slave_rx_buffer[10];
static int spi_slave_write_test_msg(void)
{
	static uint8_t counter = 0;


	const struct spi_buf s_tx_buf = {
		.buf = slave_tx_buffer,
		.len = sizeof(slave_tx_buffer)
	};
	const struct spi_buf_set s_tx = {
		.buffers = &amp;amp;s_tx_buf,
		.count = 1
	};

	struct spi_buf s_rx_buf = {
		.buf = slave_rx_buffer,
		.len = sizeof(slave_rx_buffer),
	};
	const struct spi_buf_set s_rx = {
		.buffers = &amp;amp;s_rx_buf,
		.count = 1
	};

	// Update the TX buffer with a rolling counter
	slave_tx_buffer[1] = counter++;
	//printk(&amp;quot;SPI SLAVE TX: 0x%.2x, 0x%.2x\n&amp;quot;, slave_tx_buffer[0], slave_tx_buffer[1]);

	// Reset signal
	k_poll_signal_reset(&amp;amp;spi_slave_done_sig);
	
	// Start transaction
	int error = spi_transceive_signal(spi_slave_dev, &amp;amp;spi_slave_cfg, &amp;amp;s_tx, &amp;amp;s_rx, &amp;amp;spi_slave_done_sig);
	if(error != 0){
		printk(&amp;quot;SPI slave transceive error: %i\n&amp;quot;, error);
		return error;
	}
	return 0;
}

static int spi_slave_check_for_message(void)
{
    int signaled = 0;
    int result = 0;
    
	k_poll_signal_check(&amp;amp;spi_slave_done_sig, &amp;amp;signaled, &amp;amp;result);
    
	if(signaled != 0){
		return 0;
    }else{
        return -1;
    }
}

/*
 * A build error on this line means your board is unsupported.
 * See the sample documentation for information on how to fix this.
 */
//static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(LED0_NODE, gpios);

int main(void)
{
//	int ret;

	spi_slave_init();

	printk(&amp;quot;SPI slave example started\n&amp;quot;);
	
	spi_slave_write_test_msg();

	while (1) {

		if(spi_slave_check_for_message() == 0){
			// Print the last received data
			//printk(&amp;quot;SPI SLAVE RX: 0x%.2x, 0x%.2x\n&amp;quot;, slave_rx_buffer[0], slave_rx_buffer[1]);
			printk(&amp;quot;SPI SLAVE RX: %c%c%c%c%c%c\n&amp;quot;, slave_rx_buffer[0], slave_rx_buffer[1],
			slave_rx_buffer[2], slave_rx_buffer[3],
			slave_rx_buffer[4], slave_rx_buffer[5]);

			// Prepare the next SPI slave transaction
			spi_slave_write_test_msg();
		}
	}

	return 0;
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;prj.conf&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_GPIO=y

CONFIG_SPI=y
CONFIG_SPI_ASYNC=y

CONFIG_SPI_SLAVE=y
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf54l15dk-nrf54l15.overlay&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;pinctrl {
 
        spis00_default: spis00_default {
		group1 {
			psels = &amp;lt;NRF_PSEL(SPIS_SCK, 2, 6)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIS_MOSI, 2, 9)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIS_MISO, 2, 8)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIS_CSN,  2, 10)&amp;gt;;

		};
	};

	spis00_sleep: spis00_sleep {
		group1 {
			psels = &amp;lt;NRF_PSEL(SPIS_SCK, 2, 6)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIS_MOSI, 2, 9)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIS_MISO, 2, 8)&amp;gt;,
				&amp;lt;NRF_PSEL(SPIS_CSN,  2, 10)&amp;gt;;
                        low-power-enable;
		};
	};


};

/* uart20 is being used for serial communication, so use spi21*/
&amp;amp;spi00 {
    /delete-property/rx-delay-supported;
    /delete-property/rx-delay;
    status = &amp;quot;okay&amp;quot;;
    compatible = &amp;quot;nordic,nrf-spis&amp;quot;;
    pinctrl-0 = &amp;lt;&amp;amp;spis00_default&amp;gt;;
    pinctrl-1 = &amp;lt;&amp;amp;spis00_sleep&amp;gt;;
    pinctrl-names = &amp;quot;default&amp;quot;, &amp;quot;sleep&amp;quot;;
    def-char = &amp;lt;0x00&amp;gt;;
};


/*
&amp;amp;uart20 {
    status = &amp;quot;disabled&amp;quot;;
};
*/
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The SPIM has been changed from the nRF54L15 to the nRF52840, and the SPI sample from the nRF5 SDK has been modified accordingly.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best regards.&lt;/p&gt;
&lt;p&gt;Kenta.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question: About SPIS of nRF54L15-DK</title><link>https://devzone.nordicsemi.com/thread/521445?ContentTypeID=1</link><pubDate>Wed, 05 Feb 2025 07:01:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25456dfd-5704-45fd-a72f-ba245bfcc49a</guid><dc:creator>Zugislav</dc:creator><description>&lt;p&gt;I also changed like you to SPI00 and the same pins.&lt;br /&gt;&lt;br /&gt;only change is this:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static const struct spi_config spi_slave_cfg = {
	.operation = SPI_WORD_SET(8) | SPI_TRANSFER_MSB |
				 SPI_MODE_CPHA | SPI_OP_MODE_SLAVE,
	.frequency = 1000000,
	.slave = 0,
};&lt;/pre&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;but beside that i also want to use signals.&lt;br /&gt;&lt;br /&gt;My code goes like this:&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static int spi_slave_check_for_message(void)
{
	int signaled, result;
	k_poll_signal_check(&amp;amp;spi_slave_done_sig, &amp;amp;signaled, &amp;amp;result);
	if(signaled != 0){
        for(int i = 0; i &amp;lt; result; i++){
            LOG_INF(&amp;quot;rx[%d] = %d&amp;quot;, i, s_rx_buf[i]);
        }
		return result;
	}
	else return -1;
}

//after all init in main
//reset the signal, that is all in main
k_poll_signal_reset(&amp;amp;spi_slave_done_sig);

int ret = spi_transceive_signal(spi_slave_dev, &amp;amp;spi_slave_cfg, &amp;amp;tx_set, &amp;amp;tx_set, &amp;amp;spi_slave_done_sig);

//end of main

//function that is called in a loop
void function(){
 int ret = spi_slave_check_for_message();

    if (ret &amp;lt; 0){
        LOG_DBG(&amp;quot;SPI check for message result %d&amp;quot;, ret);
        return;
    }
    LOG_INF(&amp;quot;message result %d&amp;quot;, ret);
    LOG_INF(&amp;quot;buf size is %d&amp;quot;, strlen(rx_set.buffers-&amp;gt;buf));
    
    //process data and put data in tx buf if needed
    
        LOG_INF(&amp;quot;reseting the signal&amp;quot;);
    // Reset signal
	k_poll_signal_reset(&amp;amp;spi_slave_done_sig);
    LOG_INF(&amp;quot;signal reset&amp;quot;);
    //start new transaction
	spi_transceive_signal(spi_slave_dev, &amp;amp;spi_slave_cfg, &amp;amp;tx_set, &amp;amp;rx_set, &amp;amp;spi_slave_done_sig);

    LOG_INF(&amp;quot;new spi function called&amp;quot;);
    
}


    
    
&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;now the main problem is data that should be inside rx_buffer is 0. But when checking for message i get that result variable is above zero so there was some data inside. Using debugger i also have not found any data inside rx_buffer so if somehow you know what is going on I would be grateful.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question: About SPIS of nRF54L15-DK</title><link>https://devzone.nordicsemi.com/thread/517352?ContentTypeID=1</link><pubDate>Wed, 08 Jan 2025 02:09:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2857de50-3582-45c2-b736-b30461ab22b3</guid><dc:creator>Kenta</dc:creator><description>&lt;p&gt;Hi Naeem.&lt;/p&gt;
&lt;p&gt;Sorry for the late reply.&lt;/p&gt;
&lt;p&gt;The SPI Slave was using Port 2, so I changed spi22 to spi00 in the overlay file and it worked.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;br /&gt;Best regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Question: About SPIS of nRF54L15-DK</title><link>https://devzone.nordicsemi.com/thread/516402?ContentTypeID=1</link><pubDate>Sat, 28 Dec 2024 01:12:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cfb20504-140d-48af-aa47-d33a92d9e24d</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Can you change the CLK pin and retest as mentioned here:&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-5-serial-peripheral-interface-spi/topic/exercise-1-10/#:~:text=nRF54L15%20DK%20pin%20restrictions%3A%20The%20SPI21%20instance%20must%20use%20pins%20on%20port%20P1.%20Only%20select%20pins%20on%20P1%20can%20be%20used%20for%20clock%20pins%20(P1.03%2C%20P1.04%2C%20P1.08%2C%20P1.11%2C%20and%20P1.12).%20Pins%20P1.00%20%E2%80%93%20P1.07%20are%20used%20by%20default%20on%20the%20nRF54L15%20DK%2C%20so%20this%20means%20that%20pins%20P1.08%2DP1.14%20will%20be%20eligible%20for%20this%20exercise."&gt;NRF54L Pin Restrictions&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>