<?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>SSADC swapping scanning values depending on the speed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/95269/ssadc-swapping-scanning-values-depending-on-the-speed</link><description>Hi, 
 We have an application scanning 4 ADC inputs AN1, AN5, AN6 and AN7 
 We setup the SSADC in scanning mode: 
 
 
 We start sampling the ADC on a regular basis using PPI: 
 
 Here is the SSADC callback, we do averaging here too. 
 
 The buffer is setup</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 03 Jan 2023 11:52:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/95269/ssadc-swapping-scanning-values-depending-on-the-speed" /><item><title>RE: SSADC swapping scanning values depending on the speed</title><link>https://devzone.nordicsemi.com/thread/402935?ContentTypeID=1</link><pubDate>Tue, 03 Jan 2023 11:52:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:240a9000-10e3-4903-a962-629ad9c338a0</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Happy new year!&lt;/p&gt;
&lt;p&gt;Thanks for the update.&amp;nbsp;I think I know what is happening now: the&amp;nbsp;TIMER will continue to trigger the SAADC sample task even if the application has been prevented from processing the&amp;nbsp;NRF_DRV_SAADC_EVT_DONE event and provided the SAADC with a new DMA sample buffer, same as&amp;nbsp;the scenario Jørgen describes in this post:&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/20291/offset-in-saadc-samples-with-easy-dma-and-ble/79053"&gt;RE: Offset in SAADC samples with Easy DMA and BLE&lt;/a&gt;&amp;nbsp;.&lt;/p&gt;
&lt;p&gt;1.&amp;nbsp; This seems to be a side effect of not following the task and event order outlined in the product specification. I.e. if the SAMPLE task gets triggered before the next DMA buffer has been supplied and the start task has been triggered by&amp;nbsp;&lt;span&gt;nrf_drv_saadc_buffer_convert().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;2. It will do both. But it requires that you have run the&amp;nbsp;nrf_drv_saadc_buffer_convert() first&amp;nbsp;to prepare the SAADC for sampling.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;3. Sequentially.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;4. Yes, the callback is invoked when the sample buffer has been filled.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;5. Yes, it will trigger the&amp;nbsp;NRF_DRV_SAADC_EVT_DONE (assuming a single conversion will fill the sample buffer).&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SSADC swapping scanning values depending on the speed</title><link>https://devzone.nordicsemi.com/thread/402812?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2023 12:49:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2cc8430e-8018-41a8-9057-db0bfb00e635</guid><dc:creator>Yano</dc:creator><description>&lt;p&gt;Hi Vidar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Happy new year!&lt;/p&gt;
&lt;p&gt;No we&amp;#39;re not using that.&lt;/p&gt;
&lt;p&gt;However I think we&amp;#39;ve found the issue.&lt;/p&gt;
&lt;p&gt;We setup a test array and on each saadc call back we filled the array with the adc buffer.&lt;/p&gt;
&lt;p&gt;When analysing what we saw was that the buffer skip happened on the 6th call back.&lt;/p&gt;
&lt;p&gt;We then looked at a trace (see below), the top line indicates timer interrupts and the next two i2c operation in the saadc callback. As you can see there was a period after the 5th where there is no call back.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1672661458442v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;It turns out this is BLE setup, as we set up the timer and ADC before BLE setup.&lt;/p&gt;
&lt;p&gt;Moving it fixed the issue.&lt;/p&gt;
&lt;p&gt;We still have a few questions:&lt;/p&gt;
&lt;p&gt;1. Why would the BLE blocking shift the SAADC buffer pointer?&lt;/p&gt;
&lt;p&gt;2. Does&amp;nbsp;nrfx_saadc_sample() only start the ADC acquisition (not conversion)?&lt;/p&gt;
&lt;p&gt;3. If there are multiple channels are they all acquired at the same time or sequentially?&lt;/p&gt;
&lt;p&gt;4. Is the ADC callback called when the acquisition is completed?&lt;/p&gt;
&lt;p&gt;5. When we call&amp;nbsp;nrfx_saadc_sample() to convert is there a way to know when its completed?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SSADC swapping scanning values depending on the speed</title><link>https://devzone.nordicsemi.com/thread/402802?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2023 12:01:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c555c0b-e2c3-429f-be9f-66c5b7dafbaa</guid><dc:creator>Vidar Berg</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;As far as I am aware, the only known issue which can lead to this behavior you describe is if you use the calibrate offset task when the SAADC is active (&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52833_Rev2/ERR/nRF52833/Rev2/latest/anomaly_833_252.html?cp=4_1_1_0_1_30"&gt;[252] SAADC: Unexpected behavior when TASKS_CALIBRATEOFFSET is used during sampling&lt;/a&gt;). Are you doing calibration anywhere in your code outside of the saadc_callback()?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Vidar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>