<?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>NRF51822 SPI Master</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20016/nrf51822-spi-master</link><description>Hi, 
 I used the nrf51822 as the spi master,it could send out the data, but it didn&amp;#39;t receive the slave data.Did I miss somthing? 
 static volatile bool m_transfer_completed = true;

static void spi_master_0_event_handler(spi_master_evt_t spi_master_evt</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 28 Feb 2017 23:52:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20016/nrf51822-spi-master" /><item><title>RE: NRF51822 SPI Master</title><link>https://devzone.nordicsemi.com/thread/77923?ContentTypeID=1</link><pubDate>Tue, 28 Feb 2017 23:52:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b8bb7af-e504-4aba-90ac-002f169b9de1</guid><dc:creator>Roger Clark</dc:creator><description>&lt;p&gt;In addition to what Petter has said..&lt;/p&gt;
&lt;p&gt;It looks like you may have transposed MISO and MOSI, but its hard to tell as you named one of them MSIO which is not a valid name in terms of SPI&lt;/p&gt;
&lt;p&gt;Why don&amp;#39;t you just used nrf_drv_spi_transfer() rather than separate send and receive calls&lt;/p&gt;
&lt;p&gt;The SPI protocol has simultaneous bidirectional communication.
For every clock pulse, you will output 1 bit of data on MOSI but also receive 1 bit of data on MISO&lt;/p&gt;
&lt;p&gt;Also. Looking at your logic analyser image, the number of clock pulses look wrong
tabAddr is 4 bytes, but the API is only writing 2 bytes
probably caused by this line&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; gt_err_code = spi_master_send_recv(SPI_MASTER_0, tabAddr, 4, p_arr, 2);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So its not sending the 4 byte buffer in one hit&lt;/p&gt;
&lt;p&gt;I suspect the data you passed in to TAB_addr is 0x16xxxx hence its just sending 0x03 0x16 for the first 2 bytes&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51822 SPI Master</title><link>https://devzone.nordicsemi.com/thread/77922?ContentTypeID=1</link><pubDate>Mon, 27 Feb 2017 18:12:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:57272eb6-3553-4c79-baa6-1f55eed4cd47</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;What is MSOI? MOSI or MISO? What SDK are you using? Have you tested the SPI example in the SDK to check that it works? What kind of hardware are you using? Our DK or custom?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>