<?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>SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66151/saadc-easydma-timer</link><description>Is there an example that shows the &amp;quot;Nordic way&amp;quot; of &amp;quot;continuous&amp;quot; conversions using DMA? I think a timer and PPI are needed to generate a conversion task for each timer compare event? 
 Also, the SAADC END (of EasyDMA transfers for a conversion round) event</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Sep 2020 09:34:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66151/saadc-easydma-timer" /><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270773?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 09:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4316637a-89db-42bd-a969-9b352e5f9759</guid><dc:creator>turboscrew</dc:creator><description>&lt;p&gt;I&amp;#39;m probably not mixing HAL and NRFX much anymore, but I do look at the HW documentation. I&amp;#39;m just concerned about, possibly, too many interrupts eating up the processor cycles. I&amp;#39;m sampling 4 channels&amp;nbsp; every 2.5 ms, I need to write some driving data via SPI, I need to read some more data (at different rate) via SPI and I need to store the data into an SPI-flash. Something like 2.5 kBps. There&amp;#39;s also BLE connection for commands and responses.&lt;/p&gt;
&lt;p&gt;We need to figure out if NFR25832 / nRF5 SDK is a good way to go.&lt;/p&gt;
&lt;p&gt;Now the HW looks fine (at least so far), but I&amp;#39;m still not sure about the SDK.&lt;/p&gt;
&lt;p&gt;It looks like the HW would be capable of reading arbitrary many &amp;quot;scans&amp;quot; of ADC-values without SW intervention. That approach is not very useful to us for the task at hand, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270765?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 09:16:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:875ff6ba-9d93-4c4d-98bc-622eaa6df43a</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="turboscrew"]BTW, if I try to look into the SAADC V2 driverAPI[/quote]
&lt;p&gt;Yes, it seems that the API documentation for SAADC V2 is not found, I will alert our technical writes about this.&lt;br /&gt;In the meantime, you may see the API documentation in the inline docstrings in the SDK17/modules/nrfx/include/nrfx_saadc_v2.h file. The API Reference documentation is generated from this file, and is an exact match of the docstrings in the .h file.&lt;/p&gt;
[quote user="turboscrew"]I guess this means that EVENTS_DONE signals that the last conversion is done, but the results are not yet read from the registers to memory?[/quote]
&lt;p&gt;I think you might still be confusing the HAL and NRFX_driver events and interrupts. As I said in my initial reply, I advise you to only use one of them; either use only the HAL, or only the nrfx_driver. If you use both, then the driver might be placed in an invalid state and/or behave unpredictable.&lt;br /&gt;Which one do you intend to use? If you intend on using the nrfx_driver ( which I recommend highly ) you will not need to use the SAADC HAL events at all.&lt;br /&gt;The SAADC peripheral documentation is written about the peripheral itself, and neither cares nor knows for the existence of the nrfx_driver.&lt;/p&gt;
[quote user="turboscrew"]Also, does timer always generate interrupts internally? I was hoping to set the HW up such that timer compare just trigs an ADC scan (conversion of 4 channels) with DMA, and I only get an interrupt (event) after the DMA is finished, to start the next timer compare (and ADC scan).[/quote]
&lt;p&gt;If the SAADC is configured to SCAN mode, and the START task is triggered, it will scan all the enabled channels. When the provided buffer is filled, the DONE event is generated.&lt;br /&gt;What do you mean when you ask if the timer always generate interrupts internally? If the TIMER COMPARE event is linked to the SAADC through PPI then the interrupt will be generated externally from the SAADC. You may leave the event handler passed to your TIMER empty, if you would like.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270763?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 09:13:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7954af3-a336-4857-9289-d4ad9b85e235</guid><dc:creator>turboscrew</dc:creator><description>&lt;p&gt;Aha, the driver&amp;#39;s interrupt routine checks the actual event, and if it&amp;#39;s END, the interrupt routine calls the callback function with DONE-event.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270736?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 07:16:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:810569c3-1100-4adb-b42d-c4b4d8b6e2bd</guid><dc:creator>turboscrew</dc:creator><description>&lt;p&gt;BTW, if I try to look into the SAADC V2 driverAPI, I get:&lt;/p&gt;
&lt;p&gt;&amp;quot;&lt;/p&gt;
&lt;h2&gt;HTTP ERROR: 404&lt;/h2&gt;
&lt;p&gt;Problem accessing /help/drivers/include/nrfx_saadc_v2.h. Reason:&lt;/p&gt;
&lt;pre&gt;    ProxyServlet: /help/drivers/include/nrfx_saadc_v2.h&lt;br /&gt;&amp;quot;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270734?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 07:08:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ec46a659-73a6-4a44-996d-8f4b70966dbd</guid><dc:creator>turboscrew</dc:creator><description>&lt;p&gt;Also, does timer always generate interrupts internally? I was hoping to set the HW up such that timer compare just trigs an ADC scan (conversion of 4 channels) with DMA, and I only get an interrupt (event) after the DMA is finished, to start the next timer compare (and ADC scan).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270731?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2020 07:01:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3461b905-d7f9-4d0e-86fd-158ab6c666b9</guid><dc:creator>turboscrew</dc:creator><description>&lt;p&gt;Hmm, the nRF52832 data sheet says:&lt;/p&gt;
&lt;p&gt;&amp;quot;The EasyDMA will have finished accessing the RAM when the END or STOPPED event has been generated.&amp;quot;&lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;&amp;quot;EVENTS_DONE 0x108 A conversion task has been completed. Depending on the mode, multiple conversions might be&lt;br /&gt;needed for a result to be transferred to RAM.&amp;quot;&lt;/p&gt;
&lt;p&gt;I guess this means that EVENTS_DONE signals that the last conversion is done, but the results are not yet read from the registers to memory?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC + EasyDMA + timer</title><link>https://devzone.nordicsemi.com/thread/270660?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 15:12:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e4dbd85-c507-4cd4-a3a5-8c8abeac5157</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]Is there an example that shows the &amp;quot;Nordic way&amp;quot; of &amp;quot;continuous&amp;quot; conversions using DMA? I think a timer and PPI are needed to generate a conversion task for each timer compare event?[/quote]
&lt;p&gt;Additionally, you can check out &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples"&gt;how things are done in this github repository&lt;/a&gt;&amp;nbsp;- please not that the NordicPlayground repositories are just intended as simple demos, and are not as thoroughly tested as our SDK examples.&lt;/p&gt;
&lt;p&gt;[quote user=""][/quote]&lt;/p&gt;
&lt;p&gt;I didn&amp;#39;t find library support for ADC with DMA.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fsaadc.html&amp;amp;anchor=saadc_easydma"&gt;saadc peripheral uses easyDMA&lt;/a&gt;, by extension so does the nrfx_saadc and nrfx_saadc2 drivers.&lt;/p&gt;
[quote user=""]Also, the SAADC END (of EasyDMA transfers for a conversion round) event is still available for interrupt?[/quote]
&lt;p&gt;No, the END event is not part of the nrfx_saadc driver - this is only available to the driver itself, or in the SAADC HAL.&lt;br /&gt;I would advice against mixing from both SAADC HAL and the nrfx driver, as this may place the driver in an invalid state.&lt;br /&gt;I would also recommend using the driver instead of implementing the functionality yourself from HAL - since a lot of this work is already done for you in the driver.&lt;br /&gt;&lt;br /&gt;If you want to do continuous sampling you should use the double buffering feature, and instead do your data processing once one buffer fills up - generating the DONE event.&lt;br /&gt;&lt;br /&gt;Please do not hesitate to ask if anything should be unclear, or if you should encounter any issues or questions!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>