<?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 Slave: inspect data before transfer complete?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/3964/spi-slave-inspect-data-before-transfer-complete</link><description>I&amp;#39;m trying to emulate an nRF24L01+ SPI slave interface with an nRF51822. The nRF24L01+ interprets the first byte in the SPI transfer as a &amp;quot;command&amp;quot;, and the data that it will shift out in the same SPI transaction depends on the first byte received from</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 07 Oct 2014 08:14:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/3964/spi-slave-inspect-data-before-transfer-complete" /><item><title>RE: SPI Slave: inspect data before transfer complete?</title><link>https://devzone.nordicsemi.com/thread/14270?ContentTypeID=1</link><pubDate>Tue, 07 Oct 2014 08:14:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bef85abd-ebe7-4c09-85b0-d95831134e8b</guid><dc:creator>yd</dc:creator><description>&lt;p&gt;I read that. He also said in another post (&lt;a href="https://devzone.nordicsemi.com/question/17328/spi-slave-inspect-data-before-transfer-complete/?answer=17349#post-id-17349)"&gt;devzone.nordicsemi.com/.../&lt;/a&gt; that it is not possible to do any data processing between first and second bytes. If the data gets clocked out on the third byte, he will have to change the master anyways. So, I gave him an alternative. Changing the master to set the pin high for a few microseconds is pretty easy and it ensures data integrity instead of possibly running into a race condition trying to set bytes while the SPI communication is active. This is a better way to communicate with SPI slaves. Send a command, wait for the processing and get data.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave: inspect data before transfer complete?</title><link>https://devzone.nordicsemi.com/thread/14269?ContentTypeID=1</link><pubDate>Mon, 06 Oct 2014 02:20:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b8ed37fe-807c-4595-9c6e-a44764327029</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;That&amp;#39;s not what the original poster is asking. He&amp;#39;s not looking to change the protocol or re-implement how the master works, he&amp;#39;s looking to implement a slave for an existing master, he even makes it clear in the original question (by putting it in italics) that the data &lt;em&gt;must&lt;/em&gt; go out in the same transaction.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave: inspect data before transfer complete?</title><link>https://devzone.nordicsemi.com/thread/14268?ContentTypeID=1</link><pubDate>Sat, 04 Oct 2014 00:16:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95edd412-f91a-4bcf-a84f-3ec7d70d434c</guid><dc:creator>yd</dc:creator><description>&lt;p&gt;The master controls the flow of the communication. You can first send out one byte from master and end the communication by pulling the CSN high. That will generate END event on the SPI slave. Then you can check the byte and fill the SPI buffers on the SPI slave with appropriate data. After you give SPI slave enough time to do its work, you can have the SPI master set the CSN low again to get the data form the SPI slave. Try using timers or delay functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave: inspect data before transfer complete?</title><link>https://devzone.nordicsemi.com/thread/14267?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2014 15:00:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c8f53afd-94af-4a61-bef6-2d0f74190fbf</guid><dc:creator>Andrew Kohlsmith</dc:creator><description>&lt;p&gt;Yes, I spent a few hours last night with the pin change interrupt and spinning on the received byte to see when it was received. I can detect this and respond quickly enough but as soon as I try to do any data processing (i.e. responding differently to different command bytes) it falls down and my response is sent in the third byte instead of the second.&lt;/p&gt;
&lt;p&gt;at 16MHz there just isn&amp;#39;t enough time. At 32MHz there may be, but I think that after the BLE soft device has taken its toll in CPU time I&amp;#39;ll be back to where I started.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI Slave: inspect data before transfer complete?</title><link>https://devzone.nordicsemi.com/thread/14266?ContentTypeID=1</link><pubDate>Wed, 01 Oct 2014 13:24:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4367f0be-91bb-4120-b0c4-3e4f8893db6e</guid><dc:creator>Stian R&amp;#248;ed Hafskjold</dc:creator><description>&lt;p&gt;I don&amp;#39;t think there are any easy way to do this. If you are going to use the SPI slave hardware peripheral (SPIS), there are no other events generated from this peripheral than END and ACQUIRED. END tells you when the whole transmission has finished, and ACQUIRED is when the SPIS has been granted access to the RXDPTR and TXDPTR registers. So, there is no event that tells you when only the first byte has been received.&lt;/p&gt;
&lt;p&gt;You can try to write your own software SPI slave that does this, but I don&amp;#39;t think the nRF51822 is fast enough to do the processing that needs to be done after the first byte has been received, in order to shift out valid data on the next byte. This was done in hardware on the nRF24L01, and hence a lot faster.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>