<?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 update SPIM TXD.PTR/RXD.PTR safely?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/72185/how-to-update-spim-txd-ptr-rxd-ptr-safely</link><description>Hi, 
 I am using SPIM in nrf5340 to read datas from 2 sensors. The sample rate is 400Hz, and I have to send and receive 8 bytes to each sensor every 2.5ms. 
 So I set up one TX buffer and two RX buffer: 
 
 The WriterList contains the address for reading</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 04 Mar 2021 02:58:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/72185/how-to-update-spim-txd-ptr-rxd-ptr-safely" /><item><title>RE: How to update SPIM TXD.PTR/RXD.PTR safely?</title><link>https://devzone.nordicsemi.com/thread/297651?ContentTypeID=1</link><pubDate>Thu, 04 Mar 2021 02:58:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c54c5958-cf58-49bb-b6dc-6bb52bc8b88a</guid><dc:creator>squwal</dc:creator><description>&lt;p&gt;Thank you Jorgen, everything goes well now!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to update SPIM TXD.PTR/RXD.PTR safely?</title><link>https://devzone.nordicsemi.com/thread/297262?ContentTypeID=1</link><pubDate>Tue, 02 Mar 2021 15:26:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f6fd7e0b-4858-48e5-8fd8-2450a1fc33b7</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It should be safe to update the pointers between a END event and triggering of the START task. It is not fully clear from the posted code snippets how you handle this transition. Is this handled by the default IRQ handler in the driver, or do you handle it manually in your application?&lt;/p&gt;
&lt;p&gt;You may need to temporarily pause the triggering of the START task while updating the pointers to make sure you can update the pointer safely. One possible way to do this is to use a PPI channel to automatically trigger the START task on reception of the END event, and concurrently count the number of generated END events from the SPIM using a TIMER in count mode. You can then use COMPARE event from this counter to disable to PPI channel that triggers the SPIM START task when you have reached the number og available buffers, and at the same time trigger an interrupt&amp;nbsp;that is used to update the buffer pointers (instead of using the 1.5s timer interrupt for this).&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>