<?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>nRF51 SPI slave: queuing new buffers during a potential SPI transaction</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48231/nrf51-spi-slave-queuing-new-buffers-during-a-potential-spi-transaction</link><description>Hi, I am using the nRF51822 with SDK 12.3.0 
 I am trying to make use of nrf_drv_spis driver included in the SDK. 
 My purpose is to have nRF51822 constantly be RX-ing over SPI - which means it will TX exactly 1B: 0x00. However every now and then, it</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Jun 2019 16:19:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48231/nrf51-spi-slave-queuing-new-buffers-during-a-potential-spi-transaction" /><item><title>RE: nRF51 SPI slave: queuing new buffers during a potential SPI transaction</title><link>https://devzone.nordicsemi.com/thread/191705?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 16:19:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ac0a512f-209b-4b54-8523-d5512f33f1ed</guid><dc:creator>shadowncs</dc:creator><description>&lt;p&gt;Hi Jorgen,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;After&amp;nbsp;calling&amp;nbsp;&lt;span&gt;nrf_drv_spis_buffers_set , I will receive the following events:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;- BUFFERS_SET&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;- XFER_DONE (sorry, I used COMPLETED by mistake)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I receive these events in both scenarios: when&amp;nbsp;SPI is idle (semaphore not held) and when SPI is busy (holds semaphore)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;nbsp;know for sure the BUFFERS_SET refers to my new buffers, no matter what scenario&amp;nbsp;we&amp;#39;re in.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;nbsp;can&amp;#39;t tell if XFER_DONE refers to the original set of buffers (which were exchanged if SPI was busy when calling nrf_drv_spis_buffers_set) or the new buffers (which were exchanged later on next SPI transaction if SPI was idle when calling nrf_drv_spis_buffers_set)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Therefore there is no way to&amp;nbsp;know&amp;nbsp;which RX buffer to process and&amp;nbsp;which TX buffer was sent.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps,&lt;/p&gt;
&lt;p&gt;Cristian&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51 SPI slave: queuing new buffers during a potential SPI transaction</title><link>https://devzone.nordicsemi.com/thread/191691?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 15:15:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0abdb4d9-ace2-4746-b37c-584a73c2d8da</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure I understood&amp;nbsp;your question correctly, but it sounds like an issue that you should be able to solve by setting a flag whenever you set the second buffer and a flag that indicates that you should check the default buffer on the first COMPLETED event?&lt;/p&gt;
&lt;p&gt;When you receive the first COMPLETED event, you process the first buffer and avoid setting new buffers, then clear this flag. On the next COMPLETED event, you check the flag that indicates that the second buffer is used, process this, set up the first buffer again, before clearing this flag as well.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>