<?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>SPI Master - Slave sample under zephyr</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84578/spi-master---slave-sample-under-zephyr</link><description>I can not get the SPI Slave function working on nRF52840 (nrf52840dk_nrf52840 board). My goal is to have spi0 as master and spi1 as slave. 
 By linking the MISO en MOSI lines, CS and clock lines, I want to send data from spi0 to spi1. 
 In the nrf52840dk_nrf52840</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Feb 2022 17:17:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84578/spi-master---slave-sample-under-zephyr" /><item><title>RE: SPI Master - Slave sample under zephyr</title><link>https://devzone.nordicsemi.com/thread/352429?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 17:17:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb4fccb7-60d8-44a9-8f69-d7e6d60ef3ed</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi Bob,&lt;/p&gt;
&lt;p&gt;Please take a look at&amp;nbsp;&lt;a href="https://github.com/sigurdnev/ncs-playground/tree/master/samples"&gt;samples&lt;/a&gt;&amp;nbsp;and this&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/69269/issues-with-implementing-spi-slave-on-nrf9160dk/285345#285345"&gt;spi slave&lt;/a&gt;&amp;nbsp;case.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Master - Slave sample under zephyr</title><link>https://devzone.nordicsemi.com/thread/352251?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 09:17:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:86b7aff3-972f-4bab-a922-a18d41052623</guid><dc:creator>BvdP4Celsius</dc:creator><description>&lt;p&gt;Thanks for your reply.&lt;/p&gt;
&lt;p&gt;However, it is still not working for me.&lt;br /&gt;I try to start an receive action as soon as I see the chip select pin become active.&lt;br /&gt;The chip select pin (cs_active) is set by a GPIO interrupt and connected to a RPY acting as the SPI master.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void spi_slave_task(void)
{
    for( ; ; )
    {
        if(cs_active)
        {
            printk(&amp;quot;chipselect_low detected\n&amp;quot;); 
            int rets = spi_transceive(spi1,&amp;amp;spi1_cfg,&amp;amp;txs,&amp;amp;rxs);
            LOG_INF(&amp;quot;spi_transceive, slave mode reported %d&amp;quot;,rets);
            if(rets &amp;gt; 0)
            {
                printk(&amp;quot;Received: 0x%02X 0x%02X 0x%02X-- \n&amp;quot;, spi1_rx_buffer[0],spi1_rx_buffer[1],spi1_rx_buffer[2]); 
            }
            cs_active = 0;
        }
        k_msleep(1);
    }
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Is there any SPI slave example available? The only examples I found are SPI master.&lt;br /&gt;Regards,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Master - Slave sample under zephyr</title><link>https://devzone.nordicsemi.com/thread/352178?ContentTypeID=1</link><pubDate>Wed, 09 Feb 2022 18:34:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fed78fdb-f8a7-4034-aec4-7b50a06ef8b6</guid><dc:creator>dejans</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;&lt;br /&gt;Based on the definitions found in zephyr\include\drivers\spi.h, you would need to make a change to your code&lt;br /&gt;&lt;br /&gt;struct spi_buf bufsm_r =&lt;br /&gt;{&lt;br /&gt; .buf = spi0_rx_buffer,&lt;br /&gt; .len = SPI_BUFFER_SIZE&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Dejan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>