<?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 scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16885/saadc-scan-mode-sample-order-is-not-always-consistent</link><description>I am seeing a problem using the nRF52 SAADC with two analog channels enabled in scan mode.
Essentially, channel 0 is measuring an analog signal with gain ~= 15 while channel 1 is measuring the same signal with gain = 1. 
 The ADC is sampled in scan</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 02 Feb 2019 11:34:45 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16885/saadc-scan-mode-sample-order-is-not-always-consistent" /><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/169152?ContentTypeID=1</link><pubDate>Sat, 02 Feb 2019 11:34:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d90e97f-4dcd-43b4-a41c-3bf632eee5bc</guid><dc:creator>Hemabas</dc:creator><description>&lt;p&gt;hey olaf,&lt;/p&gt;
&lt;p&gt;can you please elaborate to where exactly this piece of code needs to be called.&lt;/p&gt;
&lt;p&gt;thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/148291?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 20:28:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb02ed94-69be-4cee-8a1a-4e1751f5127d</guid><dc:creator>jakub</dc:creator><description>&lt;p&gt;Indeed this solution solves the problem, Thank you Olaf for sharing that.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/134614?ContentTypeID=1</link><pubDate>Mon, 04 Jun 2018 17:04:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2b9a8370-d9fe-4c9e-85d3-80451137605b</guid><dc:creator>Olaf</dc:creator><description>&lt;p&gt;I would like to share my findings on this issue. When using UART and SAADC at the same or different IRQ levels, I was experiencing this issue reproducible during startup. It happened always after a SAADC calibration while UART was processing a lot of data.&lt;/p&gt;
&lt;p&gt;Changing the IRQ priority did not help. Neither for UART nor SAADC. The &lt;em&gt;-DNRF52_PAN_28&lt;/em&gt; did not help as well.&lt;/p&gt;
&lt;p&gt;What solved the issue for me was using this sequence to stop the ADC before a next calibration:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void stop_adc()
{
	nrf_drv_saadc_uninit();
	nrf_drv_ppi_uninit();
	nrf_drv_timer_uninit(&amp;amp;m_timer);

	while (nrf_drv_saadc_is_busy())
		;

}&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/64679?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2017 08:41:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d8457e6f-c5fc-49a1-870f-3985a57af654</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;@Alessandro. I wish it was that simple. We&amp;#39;re running it at 3, should be low enough.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/64678?ContentTypeID=1</link><pubDate>Wed, 26 Jul 2017 08:37:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:067be0f9-b97c-4e03-998d-a73a18a18cd5</guid><dc:creator>Alessandro</dc:creator><description>&lt;p&gt;I had the channels swap every now and then, what solved the problem was to set the priority of the SAADC to 2 (or even 6) keeping the BLE enabled.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/64677?ContentTypeID=1</link><pubDate>Tue, 25 Jul 2017 15:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e78f89d1-81c4-4fee-804a-2fabbfeb1328</guid><dc:creator>Anne van Rossum</dc:creator><description>&lt;p&gt;I have seen all kind of behavior w.r.t. scan mode. I would love Nordic engineers to take a look at scan mode, put one pin consistently at say 3.3V and another at 0V and observe all kind of interesting effects... I assume it has to do with timing issues on the peripheral bus (related to other activities on it, e.g. addressing the encryption peripheral).&lt;/p&gt;
&lt;p&gt;Things we have seen:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Swapping of channels halfway&lt;/li&gt;
&lt;li&gt;Individual samples suddenly coming from another channel&lt;/li&gt;
&lt;li&gt;The first sample from another channel (especially if acquisition time is set low)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We still have to create a short example to show these cases, but didn&amp;#39;t have time yet to do so. Anyone heavily using scan mode and relying on correct samples should encounter these things though.&lt;/p&gt;
&lt;p&gt;See also:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://devzone.nordicsemi.com/question/119588/offset-in-saadc-samples-with-easy-dma-and-ble/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Suggestions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Regarding not swapping channels, enabling &lt;code&gt;-DNRF52_PAN_28&lt;/code&gt; solved that for us although rev1 shouldn&amp;#39;t need this PAN. Doing the scan mode in software should not be your first course of action nevertheless. It&amp;#39;s just because we got fed up by it.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Play around with the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v13.1.0%2Fgroup__nrf__drv__saadc.html"&gt;priority of ADC&lt;/a&gt;. Or even better, turn off BLE when doing ADC. I&amp;#39;ve never had the problem when doing just ADC. These problems arise only when more is done (e.g. a connection is set up and some information is acquired). A channel rotation also regularly occurred in our case in (the more involved) startup phase.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/64676?ContentTypeID=1</link><pubDate>Fri, 07 Oct 2016 15:28:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f10a084-000e-47d8-9b55-94263c6de8d8</guid><dc:creator>jprofit</dc:creator><description>&lt;p&gt;The example I presented above was simplified in order to make it brief. A full examination of both channel&amp;#39;s data shows that it is not simply a sampling rate limitation (peak error). I am sampling at 4kHz and the signal is bandwidth limited at 1kHz. The two channels&amp;#39; data can be compared directly and it is clear that one channel&amp;#39;s data is always ~15 times larger than the other (at every data point). The problem is that sometimes that channel has address offset 0 and sometimes it has address offset 2.&lt;/p&gt;
&lt;p&gt;I am wondering if this problem could be due to the fact that my code occasionally calls nrf_drv_saadc_abort(). I am thinking there may be a bug somewhere in the driver if abort is called at the wrong time or possibly the state doesn&amp;#39;t get cleared properly for my next call tonrf_drv_saadc_buffer_convert().&lt;/p&gt;
&lt;p&gt;buffer size: 2048 * 2 * sizeof(int16) = 8096 (2 byte aligned)
sample rate is 4kHz&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC scan mode sample order is not always consistent</title><link>https://devzone.nordicsemi.com/thread/64675?ContentTypeID=1</link><pubDate>Thu, 06 Oct 2016 08:01:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:155e2806-4ac5-411e-97a7-22911577e11b</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;I have not seen this problem before that you are describing. There is &lt;a href="https://github.com/NordicSemiconductor/nRF52-ADC-examples"&gt;saadc scan mode example here&lt;/a&gt; that should be similar as yours. Try to run that example and check if you get the same behavior. You probably need to set a higher sampling frequency and increase the EasyDMA sampling buffer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 6.10.2016&lt;/strong&gt;
Make sure the buffer size is a multiple of number of configured channels. If you have two channels configured, the buffer size should be 2,4,6,8,... . If the number of configured channels is 5, then the buffer size must be 5,10,15,20,...&lt;/p&gt;
&lt;p&gt;&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.EngA.errata/anomaly_832_28.html?cp=2_2_1_3_1_19"&gt;Scan mode does not work on nRF52832 Engineering A IC&lt;/a&gt;. It should work on &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52/dita/nrf52/compatibility_matrix/ic_revision_overview.html?cp=2_1_0"&gt;Engineering B, C, and revision 1&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 12.10.2016&lt;/strong&gt;
I am unable to reproduce this issue. I have made a test example that calls nrf_drv_saadc_abort when pressing button 3 on the nRF52-DK board. Sampling is resumed by pressing button 2. After If I press button 3 to stop sampling and then press button 2 to resume sampling, I get consistent SAADC output values from the two configured saadc channels before aborting and after resuming. The test example is attached and is based on t&lt;a href="https://github.com/NordicSemiconductor/nRF52-ADC-examples/tree/master/ble_app_uart__saadc_timer_driven__scan_mode"&gt;his github example&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_uart_5F005F00_saadc_5F00_timer_5F00_driven_5F005F00_scan_5F00_mode_5F005F00_abort_5F00_test.zip"&gt;ble_app_uart__saadc_timer_driven__scan_mode__abort_test.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>