<?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>HOW TO READ DATA FROM A REGISTER USING SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/64330/how-to-read-data-from-a-register-using-spi</link><description>Hello, i have been unable to read data from my sensor. 
 
 uint8_t SPI_ReadByte(uint8_t RegAddress) { ret_code_t retCode = NRF_SUCCESS; //start reading sequence m_tx_buf[0]=RegAddress|0x80; m_tx_buf[1]=0x00; retCode = nrf_drv_spi_transfer(&amp;amp;spi_master</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 31 Jul 2020 06:28:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/64330/how-to-read-data-from-a-register-using-spi" /><item><title>RE: HOW TO READ DATA FROM A REGISTER USING SPI</title><link>https://devzone.nordicsemi.com/thread/262494?ContentTypeID=1</link><pubDate>Fri, 31 Jul 2020 06:28:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:62387c07-8536-4b2e-8145-e85837243b90</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you set the spi event handler to &amp;quot;NULL&amp;quot; when initing nrf_drv_spi, then you&amp;#39;re setting the driver in blocking mode. If you&amp;nbsp;init with an event handler, then its in non-blocking mode.&lt;/p&gt;
&lt;p&gt;In your case, you can either set it in blocking mode (set event handler to NULL) or handle the _BUSY return in your SPI function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO READ DATA FROM A REGISTER USING SPI</title><link>https://devzone.nordicsemi.com/thread/262458?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 15:10:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ceca8c5a-dfe2-4db7-bf94-74f7eb5df78b</guid><dc:creator>RJD</dc:creator><description>&lt;p&gt;Hello, I am actually using that same code, its just an additional function in it. I am not getting anything. How to set it up in non-blocking mode?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HOW TO READ DATA FROM A REGISTER USING SPI</title><link>https://devzone.nordicsemi.com/thread/262348?ContentTypeID=1</link><pubDate>Thu, 30 Jul 2020 09:28:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4a412e87-5941-4d87-92ab-1d5cbc609788</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Are you setting up the nrf_drv_spi in non-blocking mode? If yes, then it is expected to see NRF_ERROR_BUSY if you do not wait until the former SPI transaction is done.&lt;/p&gt;
&lt;p&gt;Please see the nRF5 SDK example &amp;quot;peripheral/spi/&amp;quot; and look at how it handles variable &amp;quot;spi_xfer_done&amp;quot;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>