<?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 communication between Arduino and nrf51dk</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17689/spi-communication-between-arduino-and-nrf51dk</link><description>Hi, I want to send data from arduino to nrf51dk which will then use uart service to send the data over bluetooth.
I want to use SPI communication between the two microcontrollers. Can I get any working example combining SPI and nus-uart?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sun, 13 Nov 2016 02:22:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17689/spi-communication-between-arduino-and-nrf51dk" /><item><title>RE: SPI communication between Arduino and nrf51dk</title><link>https://devzone.nordicsemi.com/thread/68057?ContentTypeID=1</link><pubDate>Sun, 13 Nov 2016 02:22:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5d0c2ef6-93c2-48b5-a91a-694c6a9a009f</guid><dc:creator>Manu</dc:creator><description>&lt;p&gt;@awneil: Hi, i added the spi slave example to nus-uart but it is not working. I am not getting any error but spi section is not working though it works independently without nus(checked using spi-master). I added these two functions to nus-uart, and called spi_slave_init() in main() -&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;       static void spi_slave_init	(void)	
      {   
               nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG(SPIS_INSTANCE);
               spis_config.csn_pin               = SPIS_CS_PIN;
               memset(m_rx_buf, 0, m_length);
               APP_ERROR_CHECK(nrf_drv_spis_init(&amp;amp;spis, &amp;amp;spis_config, spis_event_handler));
               spis_xfer_done = false;
               APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&amp;amp;spis, m_tx_buf, m_length, m_rx_buf,     m_length));

            while (!spis_xfer_done)
           {
              __WFE();
            } 
	
           }
           void spis_event_handler(nrf_drv_spis_event_t event)
          {
	       if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
                       {
                          spis_xfer_done = true;
                          NRF_LOG_PRINTF(&amp;quot; Transfer completed. Received: %s\n&amp;quot;,m_rx_buf);
			
	              if(SPI_BUFFER_SIZE &amp;lt;= 20)
			{
					ble_nus_string_send(&amp;amp;m_nus, &amp;amp;m_rx_buf[0], SPI_BUFFER_SIZE);
			}					
			LEDS_INVERT(BSP_LED_3_MASK);
}	
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI communication between Arduino and nrf51dk</title><link>https://devzone.nordicsemi.com/thread/68056?ContentTypeID=1</link><pubDate>Sat, 12 Nov 2016 12:58:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3494c1e0-cc8a-4287-bc13-88360c5d1cce</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;You need to learn to break problems down into their constituent parts.&lt;/p&gt;
&lt;p&gt;In this case, two parts should be immediately apparent:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;SPI;&lt;/li&gt;
&lt;li&gt;NUS-UART.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;It should be easy enough to find examples of each - so get each one working separately, and then bring the two together.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>