<?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 with DMA Problem?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83571/spim-with-dma-problem</link><description>Hi, when debugging, I&amp;#39;m encountering this problem where relevant SPI registers (likely status registers) signaled a successful read before the actual data could be pulled into the memory. 
 Elaborating it a bit further: when using library function nrf_drv_spi_transfer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jan 2022 17:30:20 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83571/spim-with-dma-problem" /><item><title>RE: SPIM with DMA Problem?</title><link>https://devzone.nordicsemi.com/thread/348370?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 17:30:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1049d6f3-e004-40f1-9c51-70be0cc1f4ca</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Hey Helmet,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;That API call is most likely non-blocking and that ~2ms delay is the time it takes to transfer your data. If you used the API as intended then you can use that ~2ms for something useful.&lt;br /&gt;&lt;br /&gt;BR,&lt;br /&gt;Håko&amp;nbsp; Holdhus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM with DMA Problem?</title><link>https://devzone.nordicsemi.com/thread/348344?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 15:25:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b04e311c-f016-4a18-b02d-31aab17d1f10</guid><dc:creator>HelmetWithHornInstalledInside</dc:creator><description>&lt;p&gt;Hello Haakonsh, I have found the problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I believe the status (most likely) register would trigger SPI&amp;#39;s library read+write function to return the result once data is detected on the SPI bus, even though the data hasn&amp;#39;t been updated to the designated buffer area.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is particularly noticeable when the transmission speed is 125K.&lt;/p&gt;
&lt;p&gt;I put a 2ms (yes, that much) delay in the function and it fixed the problem.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So basically, after that library function returned, I wait for 2ms for the data to &amp;quot;actually&amp;quot; be updated to the buffer in the memory.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Cheers.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM with DMA Problem?</title><link>https://devzone.nordicsemi.com/thread/347512?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 08:01:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0850b19a-66c5-4b1d-8762-6aa73fda3064</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;I suggest you share the relevant code, then I can see what&amp;#39;s going on. If you&amp;#39;re not using an event handler and the transfer function is non-blocking, then you will most likely get the kind of issue that you&amp;#39;re observing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM with DMA Problem?</title><link>https://devzone.nordicsemi.com/thread/347506?ContentTypeID=1</link><pubDate>Thu, 13 Jan 2022 07:45:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:585e5519-12bf-47cb-8d79-4e3dccbd359e</guid><dc:creator>HelmetWithHornInstalledInside</dc:creator><description>&lt;p&gt;I built everything based on the SPIM example from the Nordic SDK (version 17? or so) downloaded from NordSemi official site.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That said, I pull data from SPI using on of the example function with a pointer pointing to the receiving buffer as parameter passed in.&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t care much for callbacks/handlers. Is it possible that you can only successfully update rx data with a handler? That would be a rather strange design.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPIM with DMA Problem?</title><link>https://devzone.nordicsemi.com/thread/347355?ContentTypeID=1</link><pubDate>Wed, 12 Jan 2022 11:39:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:74b3f286-efb6-49c8-bde3-eac6655ef761</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Well, the most common method for data transfers in drivers for DMA peripherals is a non-blocking transfer function and a event handler that notifies the application when a transfer is completed. How do you handle the SPIM events?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>