<?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>nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14583/nrf52832-saadc-sampling</link><description>Hi, 
 I have been able to use SAADC to measure temperature, but my code does not behave in the way I expect it to!
In the config file I have the following settings set: 
 #define SAADC_CONFIG_RESOLUTION NRF_SAADC_RESOLUTION_10BIT
#define SAADC_CONFIG_OVERSAMPLE</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 18 Aug 2016 12:10:12 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14583/nrf52832-saadc-sampling" /><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55677?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2016 12:10:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2eb41cae-54c1-4854-b143-0eac2e3953b2</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Well yes, on the nrf51 i used to do the pin switching, but that gave me some weird outliers. Probably because i&amp;#39;m sampling on a few kHz.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55676?ContentTypeID=1</link><pubDate>Thu, 18 Aug 2016 08:26:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa4a016e-4b3c-42ee-b868-e35b6243a3d2</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;@ Bart   I see your point. I am not sure how that would behave. Did not try that yet. I think more deterministic approach is to configure one saadc channel at once when oversampling. You can configure them dynamically in your program, making it work like scan mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55675?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2016 13:23:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a03979b5-2777-4a04-a2c5-1029ca6a5d17</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Well, it says &amp;quot;Oversampling and scan should not be combined, since oversampling and scan will average over input channels.&amp;quot; So that made me wonder if you can use oversampling if you just have the same input on multiple pins :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55674?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2016 13:16:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:96a89403-2f93-41d6-8688-1eb2abf9af53</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;@bart   What are you trying to achieve? Per spec, oversampling and scan mode should not be combined&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55673?ContentTypeID=1</link><pubDate>Wed, 17 Aug 2016 13:05:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb827975-e060-4cdb-b414-981790627ce9</guid><dc:creator>bart</dc:creator><description>&lt;p&gt;Hi Stefan, would it also be possible to connect one sensor to 2 pins, another sensor to 2 other pins, and then use 2x oversampling while in scan mode?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55672?ContentTypeID=1</link><pubDate>Tue, 21 Jun 2016 18:10:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:14a52547-0f45-4e27-b7d1-ad151b3a3a82</guid><dc:creator>Mark</dc:creator><description>&lt;p&gt;RE: Update 21.6.2016&lt;/p&gt;
&lt;p&gt;Great explanation.&lt;/p&gt;
&lt;p&gt;Thanks Stefan&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55671?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 21:54:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ffa5db1-aa76-4605-8a74-0760f7410a53</guid><dc:creator>Mark</dc:creator><description>&lt;p&gt;Hi Stefan,&lt;/p&gt;
&lt;p&gt;Thanks for your advice.&lt;/p&gt;
&lt;p&gt;I managed to get a sample every second by reducing buffer size to 1.&lt;/p&gt;
&lt;p&gt;I have also managed to enable oversample to 128x through nrf_drv_config.h file, and turn on BURST mode through &lt;code&gt;NRF_SAADC-&amp;gt;CH[0].CONFIG |= 0x01000000&lt;/code&gt;; so the temperature is updated every second.&lt;/p&gt;
&lt;p&gt;Am I right to assume the higher the oversample value, the more accurate ADC value will be? What is the disadvantage of high oversample values like 128x or 256x?&lt;/p&gt;
&lt;p&gt;In this &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v11.0.0%2Fgroup__nrf__drv__saadc.html&amp;amp;cp=5_0_0_6_7_17_1&amp;amp;anchor=details"&gt;link&lt;/a&gt; I read &amp;quot;If oversampling is enabled, only one channel can be enabled.&amp;quot; Does that mean I cannot use channels 1 to 7 for ADC anymore?&lt;/p&gt;
&lt;p&gt;what&amp;#39;s the difference between having a buffer size of 8 and oversampling 8x?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52832 SAADC sampling</title><link>https://devzone.nordicsemi.com/thread/55670?ContentTypeID=1</link><pubDate>Mon, 20 Jun 2016 16:54:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da6ba1de-3747-47f6-9a69-56a73561175f</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Every time you call nrf_drv_saadc_sample(), the SAADC will sample once and it will transfer one value to RAM. You will only get SAADC event every fifth time you sample because your buffer size is set to 5. If you set the buffer size to 1, you will get a callback after every SAADC sample from nrf_drv_saadc driver.&lt;/p&gt;
&lt;p&gt;If you enable oversample, the SAADC will output an averaged value to RAM every &amp;quot;oversample&amp;quot; time. If you also enable BURST mode, the SAADC will sample &amp;quot;oversample&amp;quot; number of times as fast as it can when you call nrf_drv_saadc_sample() once, and then it will output on averaged value to RAM.&lt;/p&gt;
&lt;p&gt;If you like to average numbers in your code, I suspect you can do that by decreasing the buffer size to 1 to receive event for every sample, and then do the averaging in the saadc handler.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 21.6.2016&lt;/strong&gt;&lt;br /&gt;
With oversampling enabled, noise is averaged, and as a result you will see less noise and more stable measurement. There is however a limit to how much accuracy you can get with oversampling. High oversampling will close to cancel out any white noise, while any noise that is not white will not be cancelled with oversampling. General rule is that if there is purely white noise present, quadrupling oversampling will reduce the noise level by 50%, while setting oversampling to 16x will leave 25% of the white noise. There is a limit though how much noise can be reduced. Highest ENOB can be achieved with 14-bit sampling resolution and high oversampling value, e.g. 128X or 256X. Around 11.3 ENOB is the highest obtainable for the SAADC on nRF52832 with 14-bit resolution and high oversampling, could be higher or lower for a single IC.  With 12-bit resolution and 4x oversampling, you should get around 10.5 ENOB as stated &lt;a href="https://devzone.nordicsemi.com/question/48969/nrf52-adc-enob/"&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Oversampling has drawbacks. One is that it takes longer time, therefore it decreases the maximum sampling rate. Another is that it consumes more current.&lt;/p&gt;
&lt;p&gt;That is correct, oversampling should not be combined with scan mode. That does not mean that you can not sample on multiple pins with oversampling enabled. It is possible to configure the SAADC to sample on one pin, then reconfigure it for another pin with oversampling and sample on that pin.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;With oversampling 8x and buffer size of 1, the SAADC will collect 8 samples, take the averaged value and output that averaged value to the RAM buffer. The application will get a notification as the buffer is full with only one averaged sample.&lt;/li&gt;
&lt;li&gt;With oversampling disabled and buffer size of 8, SAADC will output 8 values to the RAM buffer, then it will notify the application that the buffer is full with 8 values, but the 8 values are not averaged.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>