<?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 not as expected</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/33181/saadc-not-as-expected</link><description>I&amp;#39;m trying to sample ADC signal using 12 bit ADC resolution, but the digital signal doesn&amp;#39;t match the original one seen in the Oscilloscope. 
 Here are my ADC configurations: 
 
 and sample rate = 250ms. 
 Here is the signal measured in Oscilloscope </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 May 2018 14:58:34 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/33181/saadc-not-as-expected" /><item><title>RE: SAADC not as expected</title><link>https://devzone.nordicsemi.com/thread/132815?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 14:58:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:582a7226-bdf3-47e3-9e0d-a72a8829e21f</guid><dc:creator>PopradiArpad</dc:creator><description>&lt;p&gt;Hi Alaa,&lt;/p&gt;
&lt;p&gt;How can you use multiple channels with oversampling?&lt;/p&gt;
&lt;p&gt;As you wrote above without oversampling the measured result is very noisy.&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 not as expected</title><link>https://devzone.nordicsemi.com/thread/128352?ContentTypeID=1</link><pubDate>Sun, 15 Apr 2018 08:08:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9ab00015-8ec5-4ea6-b097-ac8c943df1c6</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;Hi,&lt;br /&gt;I&amp;#39;m using SDK 14 and I&amp;#39;m using the configurations that appear in the &lt;strong&gt;ble_app_uart__saadc_timer_driven__scan_mode&lt;/strong&gt; example here:&lt;br /&gt;&lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples"&gt;https://github.com/NordicPlayground/nRF52-ADC-examples&lt;/a&gt;&lt;br /&gt;Here&amp;#39;s my init function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void saadc_init(void)
{
    ret_code_t err_code;
	
    nrf_drv_saadc_config_t saadc_config = NRF_DRV_SAADC_DEFAULT_CONFIG;
    saadc_config.resolution = NRF_SAADC_RESOLUTION_12BIT;
	
    nrf_saadc_channel_config_t channel_0_config =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);
    channel_0_config.gain = NRF_SAADC_GAIN1_6;
    channel_0_config.reference = NRF_SAADC_REFERENCE_VDD4;
	
    nrf_saadc_channel_config_t channel_1_config =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN1);
    channel_1_config.gain = NRF_SAADC_GAIN1_4;
    channel_1_config.reference = NRF_SAADC_REFERENCE_VDD4;
	
    nrf_saadc_channel_config_t channel_2_config =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN2);
    channel_2_config.gain = NRF_SAADC_GAIN1_4;
    channel_2_config.reference = NRF_SAADC_REFERENCE_VDD4;
	
    err_code = nrf_drv_saadc_init(&amp;amp;saadc_config, saadc_callback);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_channel_init(0, &amp;amp;channel_0_config);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_saadc_channel_init(1, &amp;amp;channel_1_config);
    APP_ERROR_CHECK(err_code);
    err_code = nrf_drv_saadc_channel_init(2, &amp;amp;channel_2_config);
    APP_ERROR_CHECK(err_code);

    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0],SAADC_SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);   
    err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1],SAADC_SAMPLES_IN_BUFFER);
    APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;SAADC_SAMPLES_IN_BUFFER is 3 because I need to sample 3 ADC channels. You should adjust accordingly.&lt;/p&gt;
&lt;p&gt;Also note the SAADC configurations in the sdk_config.h file (SAADC_ENABLED 1 , etc.)&lt;/p&gt;
&lt;p&gt;About the resolution, there are 2 places:&lt;/p&gt;
&lt;p&gt;1. in sdk_config.h:&amp;nbsp;SAADC_CONFIG_RESOLUTION 2 //2 means 12 bit&lt;/p&gt;
&lt;p&gt;2. in the saadc_init() function above:&amp;nbsp;saadc_config.resolution = NRF_SAADC_RESOLUTION_12BIT&lt;/p&gt;
&lt;p&gt;Make sure they&amp;#39;re both set on the same resolution, although I think only #2 counts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC not as expected</title><link>https://devzone.nordicsemi.com/thread/128194?ContentTypeID=1</link><pubDate>Fri, 13 Apr 2018 08:57:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ae6c195-a3b2-4c82-849f-d4f825618247</guid><dc:creator>Yasser</dc:creator><description>&lt;p&gt;Hi Alaa, I&amp;#39;m actually working on the SAADC of the nRF52, in the SDK 15.0.&lt;/p&gt;
&lt;p&gt;Could you share with me the screen page of all the ADC configuration that you&amp;#39;ve made, because I don&amp;#39;t know how to configure the Gain et the Resolution of my ADC,Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC not as expected</title><link>https://devzone.nordicsemi.com/thread/127316?ContentTypeID=1</link><pubDate>Sun, 08 Apr 2018 12:54:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a05a365f-dbd0-4529-9ecf-d8420d231073</guid><dc:creator>Alaa</dc:creator><description>&lt;p&gt;Problem solved by oversampling 4x.&lt;/p&gt;
&lt;p&gt;Changed &lt;strong&gt;SAADC_CONFIG_OVERSAMPLE&lt;/strong&gt;&amp;nbsp;from 0 to 2 in file &lt;strong&gt;sdk_config.h&lt;/strong&gt; of ble_app upart.&lt;/p&gt;
&lt;p&gt;Also I changed sample rate to 100ms to make it faster...&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the new sampling graph:&lt;/p&gt;
&lt;p&gt;&lt;img alt="digital with oversampling" src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/digital-new.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>