<?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>Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/20291/offset-in-saadc-samples-with-easy-dma-and-ble</link><description>I have a nrf52 application that samples four saadc channels at 1kHZ. That is: Map four pins to ADC input and let Easy DMA take care of the sampling so that the data is processed ten times a second (100 * 4 samples). This works pretty well, except... </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 17 Apr 2020 15:05:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/20291/offset-in-saadc-samples-with-easy-dma-and-ble" /><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/245286?ContentTypeID=1</link><pubDate>Fri, 17 Apr 2020 15:05:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d375f41b-6201-422e-b12c-9ab7da1c24b4</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;1. This should prevent you from triggering the SAMPLE task while the SAADC is not started, so I believe this solution should work.&lt;/p&gt;
&lt;p&gt;2. The frequency and length of the glitches will depend on the BLE activity and other higher priority events. But this solution will shift the sampling point around in time when you start/stop the timer, is this not a problem as long as the time between the samples is constant?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/245083?ContentTypeID=1</link><pubDate>Thu, 16 Apr 2020 17:38:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4fed85da-9e1a-4c8e-bbb6-4eed65cb5fb4</guid><dc:creator>Mike Melbot</dc:creator><description>&lt;p&gt;I&amp;#39;ve just hit a similar issue.&lt;br /&gt;I&amp;#39;m using the nRF52810. I&amp;#39;m using the driver to sample 4 channels (AIN0 through AIN3) at 120 Hz to a 32-sample long double buffer using TIMER1 as a hardware timer. It&amp;#39;s very important to sample at precise intervals, so I can&amp;#39;t trigger the SAMPLE task via software.&lt;br /&gt;&lt;br /&gt;My PPI setup used to be:&lt;br /&gt;TIMER1-&amp;gt;EVENTS_COMPARE[0]&amp;nbsp;==== (short) ====&amp;gt; TIMER1-&amp;gt;TASKS_CLEAR&lt;br /&gt;TIMER1-&amp;gt;EVENTS_COMPARE[0] ==============&amp;gt; SAADC-&amp;gt;TASKS_SAMPLE&lt;br /&gt;&lt;br /&gt;(TIMER1 is started on boot via software after the SAADC is initialized)&lt;/p&gt;
&lt;p&gt;It worked fine apparently. however, when hitting a breakpoint or on some BLE events, the channel order gets swapped from 1, 2, 3, 4 to 2, 3, 4, 1.&lt;br /&gt;&lt;br /&gt;Then I stumbled upon this thread and changed the PPI setup as follows:&lt;br /&gt;&lt;span&gt;TIMER1-&amp;gt;EVENTS_COMPARE[0]&amp;nbsp;==== (short) ====&amp;gt; TIMER1-&amp;gt;TASKS_CLEAR&lt;/span&gt;&lt;br /&gt;&lt;span&gt;TIMER1-&amp;gt;EVE&lt;/span&gt;&lt;span&gt;N&lt;/span&gt;&lt;span&gt;TS_COMPARE[0] ==============&amp;gt; SAADC-&amp;gt;TASKS_S&lt;/span&gt;&lt;span&gt;AMPLE&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SAADC-&amp;gt;EVENTS_END ===============&amp;gt; TIMER1-&amp;gt;TASKS_STOP&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SAADC-&amp;gt;EVENTS_STARTED ===========&amp;gt; TIMER1-&amp;gt;TASKS_START&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;(TIMER1 is&amp;nbsp;&lt;strong&gt;not&lt;/strong&gt; started via software on boot)&lt;/p&gt;
&lt;p&gt;This way I prevent the SAMPLE task to be triggered before the driver&amp;nbsp;swaps the buffers.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;My questions:&lt;br /&gt;&lt;/strong&gt;1.- &lt;span style="text-decoration:underline;"&gt;Can you foresee any further issues with this fix?.&lt;/span&gt;&lt;br /&gt;2.- I don&amp;#39;t care about occasional glitches in the sampling interval due to the CPU being too busy to swap the buffers and trigger the SAADC START task on time when the current buffer runs out as long as they are few and sparse. &lt;span style="text-decoration:underline;"&gt;Is there potential for severe or frequent glitches with this approach, or can you suggest an alternative workaround to avoid the glitches at all?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Thanks for your assistance and take care!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/231160?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2020 13:30:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c683c6a4-b22a-4f1f-bdda-e8faaa3af803</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;So you fixed it by calling &lt;em&gt;nrf_saadc_enable()&lt;/em&gt; after the last &lt;em&gt;nrf_saadc_channel_init() &lt;/em&gt;?&lt;/p&gt;
&lt;p&gt;Would that mean you have to disable the SAADC when you want to reconfigure channels?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/229387?ContentTypeID=1</link><pubDate>Thu, 16 Jan 2020 10:47:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8dd8d434-1248-421c-bcff-1bd5522796c7</guid><dc:creator>DerPMO</dc:creator><description>&lt;p&gt;Since this just cost me a day of work:&lt;/p&gt;
&lt;p&gt;This also relates to Anomaly 74 of the nRF52832!&lt;/p&gt;
&lt;p&gt;From the Errata:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;3.15 [74]&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;SAADC: Started events fires prematurely&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;This anomaly applies to IC Rev. Rev 1, build codes QFAA-B00, QFAB-B00, CIAA-B00. It was inherited from the previous IC revision Engineering C.&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Symptoms False EVENTS_STARTED&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Conditions TACQ &amp;lt;= 5 &amp;micro;s&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Consequences The EVENTS_STARTED can come when not expected&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;Workaround The module must be fully configured before it is enabled, and the TACQ configuration must be the last configuration set before ENABLE.&lt;/p&gt;
&lt;p&gt;There is a flag in the SDK to apply the workaround, NRF52_PAN_74, but from what I can see the problem still arises when the last channel to be added has&amp;nbsp;&lt;span&gt;TACQ&amp;nbsp;&amp;gt;5&amp;micro;s and therefore the workaround is not applied!&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/169231?ContentTypeID=1</link><pubDate>Mon, 04 Feb 2019 08:42:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14e6d48f-26bb-4644-b9c3-983e6667ae71</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Hi, as mentioned before in this thread, I ended up fixing it with a timeout timer. It&amp;#39;s rather complicated, but I&amp;#39;ve never had any channel skips anymore.&lt;br /&gt;&lt;br /&gt;I described it all in this &lt;a href="https://github.com/crownstone/bluenet/blob/6ad42e77e06d675ff63fdff8f8fab2484d656ea1/docs/ADC.md"&gt;document&lt;/a&gt;, with text and uml diagrams. Code can be found on the repository too, but it&amp;#39;s part of a large whole.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/169154?ContentTypeID=1</link><pubDate>Sat, 02 Feb 2019 13:44:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7aef4b6a-3ea9-4386-88df-e19e15dc0f0a</guid><dc:creator>Hemabas</dc:creator><description>&lt;p&gt;hey jorgen &amp;amp; others,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;i am trying to sample 3 channels at 10khz with BLE. I have tried to do what users velitsu and Mathew have implemented (suggestion 1).&lt;/p&gt;
&lt;p&gt;I am still&amp;nbsp;seeing data swap between channels. I am sure how to increase size of buffers either.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;any futher suggestions ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/166500?ContentTypeID=1</link><pubDate>Fri, 18 Jan 2019 13:55:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1a3fe46-cc72-4e87-96b0-f656f73ab05b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Which SDK version are you using? For nRF52 series, &lt;a href="https://www.nordicsemi.com/DocLib/Content/SoftDevice_Spec/s132/latest/SDS/s1xx/processor_avail_interrupt_latency/exception_mgmt_sd"&gt;priority level 2, 3, 5, 6, and 7 should be available to the application&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Yes, you are correct. The larger buffer size should not eliminate the issue, only delay it. I was thinking that the SAADC would be started when the first buffer is filled, but this would require implementing solution 1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/166376?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 22:15:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79ff61f4-2f55-40d2-b92a-3cd5aba5bde1</guid><dc:creator>jpnio</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/20291/offset-in-saadc-samples-with-easy-dma-and-ble/166161"]Are you seeing the issue at 20 Hz? I would not expect this to be a problem with double buffering and buffers large enough to hold some samples for each active channel.[/quote]
&lt;p&gt;&lt;br /&gt;We are using double buffering&amp;nbsp;&lt;strong&gt;but&lt;/strong&gt; each buffer is only&amp;nbsp;&lt;strong&gt;3&lt;/strong&gt; in size (because we&amp;#39;re sampling from 3 channels... vdd, bat, and a motor).&amp;nbsp;&amp;nbsp;&lt;br /&gt;&lt;br /&gt;It&amp;#39;s unclear to me - with my current understanding of how this issue manifests - how increasing the buffer size solves the problem?&amp;nbsp; I thought this was a timing issue essentially?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/166374?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 22:06:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7cbabd8-da38-4fe4-b1f7-28a44e7ee835</guid><dc:creator>jpnio</dc:creator><description>&lt;p&gt;Thanks for your speedy response J&amp;oslash;rgen.&amp;nbsp; Your help is much appreciated.&lt;/p&gt;
&lt;p&gt;Yes, we are seeing this issue when sampling at 20Hz.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have attempted a solution using a &lt;strong&gt;nrf_drv_timer_t&amp;nbsp;&lt;/strong&gt;but I am confused on one important point:&amp;nbsp; The SAADC is by default, a priority of 6.&amp;nbsp; I create a hardware timer on channel 2, but, It seems I cannot run a timer with a priority lower (numerically higher) than 6!&amp;nbsp; See this:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="p1"&gt;&lt;strong&gt;nrf_drv_common_irq_enable.c&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="p1" style="padding-left:30px;"&gt;&lt;span class="s1"&gt;#ifdef&lt;/span&gt; SOFTDEVICE_PRESENT&lt;/p&gt;
&lt;p class="p1" style="padding-left:30px;"&gt;&lt;span class="Apple-converted-space"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;ASSERT((priority == &lt;span class="s2"&gt;APP_IRQ_PRIORITY_LOW&lt;/span&gt;) || (priority == &lt;span class="s2"&gt;APP_IRQ_PRIORITY_HIGH&lt;/span&gt;));&lt;/p&gt;
&lt;p class="p2" style="padding-left:30px;"&gt;#endif&lt;/p&gt;
&lt;p class="p2" style="padding-left:30px;"&gt;&lt;/p&gt;
&lt;p class="p2"&gt;This blocks my timer config from setting the priority lower than the ADC:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p class="p1" style="padding-left:30px;"&gt;&lt;span class="s1"&gt;nrf_drv_timer_config_t&lt;/span&gt; timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;&lt;/p&gt;
&lt;p class="p2" style="padding-left:30px;"&gt;&lt;span class="s2"&gt;timer_cfg.&lt;/span&gt;interrupt_priority&lt;span class="s2"&gt; = &lt;/span&gt;APP_IRQ_PRIORITY_LOWEST&lt;span class="s2"&gt;;&lt;/span&gt;&lt;/p&gt;
&lt;p class="p2"&gt;&lt;/p&gt;
&lt;p class="p2"&gt;So... I am at a loss on how this solution could work if I can&amp;#39;t set the priority of the timer task to&amp;nbsp;&lt;strong&gt;APP_IRQ_PRIORITY_LOWEST&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/166161?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 09:02:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0f1e5187-5d54-40e9-bf3a-18fb03393b6d</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;RTC or TIMER could be used for regular sampling. The point is to not trigger the sample task using PPI, but trigger it manually in the interrupt handler/driver callback for the RTC/TIMER peripheral.&lt;/p&gt;
&lt;p&gt;Are you seeing the issue at 20 Hz? I would not expect this to be a problem with double buffering and buffers large enough to hold some samples for each active channel.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/166092?ContentTypeID=1</link><pubDate>Wed, 16 Jan 2019 19:22:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95bdbfb9-ca6c-4f87-be5b-becc34f2f298</guid><dc:creator>jpnio</dc:creator><description>[quote userid="14926" url="~/f/nordic-q-a/20291/offset-in-saadc-samples-with-easy-dma-and-ble/79053"]Trigger sampling from CPU interrupt. If the SAMPLE task is triggered from an interrupt with lower priority than the SAADC IRQ handler, the START task will always be triggered between an END event and a new SAMPLE task.[/quote]
&lt;p&gt;Can you elaborate on this strategy?&amp;nbsp; What source interrupt can/should be used for regular sampling of the ADC?&amp;nbsp; Need to sample continuously at something like 20 Hz and avoid this swapping issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/158029?ContentTypeID=1</link><pubDate>Mon, 19 Nov 2018 15:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c1d27c68-d3ec-486c-b39e-b6894a786768</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;The SAADC buffer pointer is double buffered in hardware, meaning that you can set the next buffer immediately after the STARTED event is received. If you look at the implementation of&amp;nbsp;nrf_drv_saadc_buffer_convert, you can see that the START task is triggered right after the first buffer is set. When you call it a second time to set the second buffer, the application will block until the STARTED event is received, before setting the second buffer. When you connect the END event to START event, the second buffer will be used without any CPU activity.&lt;/p&gt;
&lt;p&gt;&amp;quot;Large enough buffers&amp;quot; will depend on your application. If you have high sample rate on SAADC and heavy BLE activity, you could require large buffers to make sure there is some CPU time available to setup a new buffer before the current one is filled. Lowering sample rate and increasing priority&amp;nbsp;&lt;strong&gt;&lt;em&gt;could&lt;/em&gt;&lt;/strong&gt;&lt;em&gt;&lt;/em&gt; increase&amp;nbsp;the possibility for the&amp;nbsp;interrupt to be handled in time, but I would not count on it without heavily testing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/156770?ContentTypeID=1</link><pubDate>Sat, 10 Nov 2018 23:19:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:092856a1-bfb4-4bbc-8484-a6f9f4a22c8f</guid><dc:creator>eyalasko</dc:creator><description>&lt;p&gt;Hi,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;As I&amp;#39;m experiencing same problems, I would like to try solution #1 above.&lt;/p&gt;
&lt;p&gt;I can trigger START task on END event using a ppi channel, however I don&amp;#39;t see how this can solve the problem as switching to the secondary buffer (nrfx_saadc_buffer_convert()) runs within SAADC interrupt handler. &lt;br /&gt;So DMA will be &amp;#39;re-armed&amp;#39; (on START event) in real time but it will overwrite the original buffer rather than the secondary buffer if interrupt is delayed...&lt;/p&gt;
&lt;p&gt;What did you mean when recommending using &amp;quot;...large enough buffers&amp;quot; ?&lt;/p&gt;
&lt;p&gt;me other questions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;My use case is sampling 4 channels (&amp;#39;scan set&amp;#39;) @ 1KHz. There are other interrupts on the system but these are extremely &amp;#39;light&amp;#39;. How vulnerable my app is to the described problem?&lt;/li&gt;
&lt;li&gt;Will lowering sample rate to e.g. 800Hz alleviate/solve the problem ? (I assume yes but want to verify)&lt;/li&gt;
&lt;li&gt;Will setting SAADC interrupt priority to 3 (its the default, 7, at the moment) alleviate/solve the problem? I assume so but there are still SD interrupts at levels 0/1 running.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Following the &amp;#39;...large enough buffers&amp;#39; advise, I was thinking of allocating large buffers (e.g. to hold 100 &amp;#39;scan sets&amp;#39; each - buffers[2][100*4]) and trigger START task by END event(ppi). This will enable up to 99 &amp;#39;lost&amp;#39; interrupts without loosing data. The thing is that I can&amp;#39;t find a way to tell how many saadc &amp;#39;scans&amp;#39; were actually written to the buffer before the interrupt was triggered (ideally 1 &amp;#39;scan set&amp;#39; but up to 99 sets in this example). RESULT.AMOUNT seems to reflect the number of samples since last START and not how many were written since setting RESULT.PTR (&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;nrfx_saadc_buffer_convert()&lt;/span&gt;)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for any advise&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/154000?ContentTypeID=1</link><pubDate>Tue, 23 Oct 2018 08:40:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1f2c3c4-abe1-43b9-848a-06c91f2a9194</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Triggering the SAMPLE task should not have any effect if there is ongoing conversion, but you will lose the sample if you expect it to fill the buffer. You can also check the &lt;a class="active" title="  STATUS  " href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_1_0_36_10_3#register.STATUS"&gt;STATUS&lt;/a&gt; register of the SAADC peripheral, to make sure that no ongoing conversions are in progress when triggering the task.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/153918?ContentTypeID=1</link><pubDate>Mon, 22 Oct 2018 18:47:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:921e9f1b-2203-4c06-9edb-5a1e22188cbf</guid><dc:creator>dlip</dc:creator><description>&lt;p&gt;Jorgen,&lt;/p&gt;
&lt;p&gt;Since the CPU interrupt is low priority for option 2, it&amp;#39;s possible that a sample task could be delayed and two triggered close to each other (i.e. before the previous conversion is complete) and wouldn&amp;#39;t this also cause a similar buffer order problem?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/142453?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 14:57:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ae4f5314-5953-4d22-b7da-5beae33f1423</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Have you tried to stop the SAADC (triggering STOP task) and setup the buffers again after you init it again? If you uninit the SAADC in the middle of a scan cycle, you might end up in the same situation, with incomplete DMA events. You should also call abort function and wait for the SAADC to complete ongoing tasks before uninit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/140945?ContentTypeID=1</link><pubDate>Mon, 23 Jul 2018 09:13:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17cd15c6-30d6-4fe6-b6f4-01c0f84cf56d</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;I ended up fixing it with a timeout timer. It&amp;#39;s rather complicated, but i&amp;#39;ve never had any channel skips anymore.&lt;/p&gt;
&lt;p&gt;I described it all in this &lt;a href="https://github.com/crownstone/bluenet/blob/6ad42e77e06d675ff63fdff8f8fab2484d656ea1/docs/ADC.md"&gt;document&lt;/a&gt;, with text and uml diagrams. Code can be found on the repository too, but it&amp;#39;s part of a large whole.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/140798?ContentTypeID=1</link><pubDate>Fri, 20 Jul 2018 09:18:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:534bc75d-7d92-491c-b64c-7829bea64a38</guid><dc:creator>Omri Friedman</dc:creator><description>&lt;p&gt;I am using PPI to connect END to START but i still DO see channels swaps.&lt;/p&gt;
&lt;p&gt;I use 3 channels and i abort ADC sampling and shut down the ADC to save power/&lt;/p&gt;
&lt;p&gt;Later on, when i re enable the sampling using the exact same code, i see one or two channels skipped so i get constant channels mismatch in my ram buffer.&lt;/p&gt;
&lt;p&gt;The number of skipped channels depend on how much delay i add before stopping the ADC when aborting.&lt;/p&gt;
&lt;p&gt;When i use 15us delay (exactly equal to 3 samples = 3us acq + 2 us convert x 3), i do get good results.&lt;/p&gt;
&lt;p&gt;But this concerns me a lot since i do not understand why is that and how to make sure timing issues will not cause the problem to re appear&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/131387?ContentTypeID=1</link><pubDate>Tue, 08 May 2018 15:12:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:488149b5-dd06-40ed-95e1-541c471edebb</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;We do not have measurements on how long time it will take from START task until STARTED event. You can test this yourself by setting and clearing a GPIO&amp;nbsp;using&amp;nbsp;PPI and&amp;nbsp;GPIOTE, and a logic analyzer to see the time the pin is set.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/130948?ContentTypeID=1</link><pubDate>Fri, 04 May 2018 08:16:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70812bfa-d95d-43f6-a441-23262f1db2ab</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Hi jorgen, if i look at figure 101 of PS v1.3, the next RESULT.PTR is set after the STARTED event. What I think happens for me sometimes, is that the RESULT.PTR is set only after the next START, and I guess that also leads to the same issue as reported in this forum post.&lt;/p&gt;
&lt;p&gt;What i&amp;#39;m now planning to use as solution is to stop the timer that triggers the SAMPLE task, if the RESULT.PTR is not set yet a few samples before the END. In that case, i will restart the ADC. (for this to work, i was wondering how much time it can take for the STARTED event to be sent after START has been called).&lt;/p&gt;
&lt;p&gt;If you have other suggestions, let me know :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/130453?ContentTypeID=1</link><pubDate>Wed, 02 May 2018 08:15:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fab7503-0d11-4982-9c04-96509ec6d52b</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;If you trigger START task when no new buffer is &amp;quot;queued&amp;quot;, the currently configured buffer will be overwritten. What do you mean by &amp;quot;SAMPLE before setting RESULT&amp;quot;? RESULTDONE is an event generated by the peripheral, it is not something you set (you can however clear it). You should not be able to get any &amp;quot;swaps&amp;quot; if using the PPI solution, as the buffer will always be ready to store samples. Please provide an example showing swapped buffers with PPI solution implemented.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/130248?ContentTypeID=1</link><pubDate>Mon, 30 Apr 2018 09:30:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:73c59c9c-6616-4c19-b002-f11ef82dd8d1</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Hi, this answer helped me a lot, and it seems to be working well!&lt;/p&gt;
&lt;p&gt;I was wondering though: what will happen if the START task is triggered while, for some reason, no buffer is queued up?&lt;/p&gt;
&lt;p&gt;***edit***&lt;/p&gt;
&lt;p&gt;So, i checked the docs and nrf_drv_saadc.c, and it seems like things can still go wrong if you SAMPLE before setting RESULT?&lt;/p&gt;
&lt;p&gt;I also did a test where i sample for a long time, using the PPI solution, and did manage to still get a swap.&lt;/p&gt;
&lt;p&gt;I was wondering: will it help if i&amp;#39;d use the ADCs internal timer? **Edit** Ah, that can&amp;#39;t be combined with scan mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/79056?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 08:17:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a7ef840-f589-4ecd-a12d-9b69843de376</guid><dc:creator>Velitsu</dc:creator><description>&lt;p&gt;Could you describe the problem a bit more? Does your code take the samples correctly, but the results get mixed up? Or is there some other kind of error?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_ppi_channel_assign(m_ppi_channel0, nrf_saadc_event_address_get(NRF_SAADC_EVENT_END), nrf_saadc_task_address_get(NRF_SAADC_TASK_START));
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is pretty much how I implemented it, although I first alloc and assign the channels and enable when everything is in place.&lt;/p&gt;
&lt;p&gt;I see no call to nrf_drv_saadc_buffer_convert function, that is needed to prepare the Easy DMA conversions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/79055?ContentTypeID=1</link><pubDate>Wed, 25 Oct 2017 00:31:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64b1dd4d-edac-444b-a037-9f109a7d55e1</guid><dc:creator>Mathew</dc:creator><description>&lt;p&gt;Are you able to elaborate on the code required to implement the first solution? I have tried the code below as a first attempt, but it hasn&amp;#39;t resolved the issue and this is probably because I haven&amp;#39;t interpreted the description of the first solution correctly.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;err_code = saadc_init();
APP_ERROR_CHECK(err_code);

nrf_drv_timer_config_t timer_config = NRF_DRV_TIMER_DEFAULT_CONFIG;
err_code = nrf_drv_timer_init(&amp;amp;m_timer, &amp;amp;timer_config, timer_handler);
RETURN_IF_ERROR(err_code);

/* setup m_timer for compare event */
uint32_t ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;m_timer, meas_interval_ms);
nrf_drv_timer_extended_compare(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0, ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false);
nrf_drv_timer_enable(&amp;amp;m_timer);

uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&amp;amp;m_timer, NRF_TIMER_CC_CHANNEL0);
uint32_t saadc_sample_event_addr = nrf_drv_saadc_sample_task_get();

err_code = nrf_drv_ppi_init();
RETURN_IF_ERROR(err_code);

/* setup ppi channel so that timer compare event is triggering sample task in SAADC */
err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel);
RETURN_IF_ERROR(err_code);

err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
RETURN_IF_ERROR(err_code);

err_code = nrf_drv_ppi_channel_assign(m_ppi_channel, timer_compare_event_addr, saadc_sample_event_addr);
RETURN_IF_ERROR(err_code);

err_code = nrf_drv_ppi_channel_alloc(&amp;amp;m_ppi_channel0);
RETURN_IF_ERROR(err_code);

err_code = nrf_drv_ppi_channel_enable(m_ppi_channel0);
RETURN_IF_ERROR(err_code);

err_code = nrf_drv_ppi_channel_assign(m_ppi_channel0, nrf_saadc_event_address_get(NRF_SAADC_EVENT_END), nrf_saadc_task_address_get(NRF_SAADC_TASK_START));
RETURN_IF_ERROR(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Offset in SAADC samples with Easy DMA and BLE</title><link>https://devzone.nordicsemi.com/thread/79054?ContentTypeID=1</link><pubDate>Tue, 12 Sep 2017 10:56:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d49f57f4-d412-41f0-a8c5-7b0d2bca931c</guid><dc:creator>Velitsu</dc:creator><description>&lt;p&gt;Thanks Jørgen. I confirm that the first solution works. Triggering NRF_SAADC_TASK_START on event NRF_SAADC_EVENT_END solves the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>