<?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>SPIM, recieve on first transmit</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/25195/spim-recieve-on-first-transmit</link><description>ADS1118: 
 
 How can I recieve the first 16 bits getting transmitted by the slave ? Will MOSI clock out p_txBuf while storing bits to arr_rxBuf if I set TX buffer len to 0, like this: 
 nrf_drv_spi_transfer(&amp;amp;spi, p_txBuf, NULL, arr_rxBuf, 2);</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Sep 2017 16:54:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/25195/spim-recieve-on-first-transmit" /><item><title>RE: SPIM, recieve on first transmit</title><link>https://devzone.nordicsemi.com/thread/99304?ContentTypeID=1</link><pubDate>Thu, 14 Sep 2017 16:54:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d69b0e57-c376-4d78-b725-38744a6eed87</guid><dc:creator>erltot</dc:creator><description>&lt;p&gt;Never mind, I feel silly - I had misunderstood how the driver works. It works as expected now.&lt;/p&gt;
&lt;p&gt;For reference, all data transmitted though MISO is stored in arr_rxBuf, for this case I just had to set&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_spi_transfer(&amp;amp;spi, p_txBuf, 2, arr_rxBuf, 2);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in order to read DATA MSB and DATA LSB.&lt;/p&gt;
&lt;p&gt;For the other case:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/SPIM.JPG" alt="SPIM2" /&gt;&lt;/p&gt;
&lt;p&gt;I just had to call&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_spi_transfer(&amp;amp;spi, p_txBuf, 2, arr_rxBuf, 4);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and DATA MSB, DATA LSB, CONFIG MSB, and CONFIG LSB is recieved in arr_rxBuf[0..3]&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>