<?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 on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/40979/saadc-on-nrf52-dk-unexpected-result</link><description>Using SDK_14 and unmodified SAADC example on pca10040. 
 Initially connected A0 (PO.03) to ground but getting seemingly random values. 
 
 &amp;lt;info&amp;gt; app: ADC event number: 586 
 &amp;lt;info&amp;gt; app: 293 
 &amp;lt;info&amp;gt; app: 76 
 &amp;lt;info&amp;gt; app: 24 
 &amp;lt;info&amp;gt; app: 292 
 &amp;lt;info</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 29 Nov 2018 14:12:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/40979/saadc-on-nrf52-dk-unexpected-result" /><item><title>RE: SAADC on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/thread/159588?ContentTypeID=1</link><pubDate>Thu, 29 Nov 2018 14:12:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1c2cba04-2a01-4b33-9a98-beecb24c4171</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Apologies for my math.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/thread/159583?ContentTypeID=1</link><pubDate>Thu, 29 Nov 2018 13:57:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a341d7d-04a0-4e3f-8b58-6953941da043</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;No, there is an error in your calculations. The output formula is given in&amp;nbsp;&lt;a title="Digital output" href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_1_0_36_2#saadc_digital_output"&gt;Digital output&lt;/a&gt;&amp;nbsp;documentation.&lt;/p&gt;
&lt;p&gt;To calculate voltage from digital output (single ended input), that would be:&lt;/p&gt;
&lt;pre&gt;V(P) = RESULT * REFERENCE / (GAIN * 2&lt;sup&gt;(RESOLUTION)&lt;/sup&gt;) or 813 * 0.6 V / (1/6 * 1024) = 2.86 V&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/thread/159570?ContentTypeID=1</link><pubDate>Thu, 29 Nov 2018 13:14:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70dddb6b-f324-44b7-82d8-66a89fa8b45b</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Thx&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I found the file ./&lt;/span&gt;&lt;span class="s1"&gt;components/drivers_nrf/hal/nrf_saadc.h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;So the reference is .6v and the gain is 1/6&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;This would translate VDD to 813/6/.6/1024 ie. 0.22v&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do there is still an issue here.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Did I do the math correctly?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/thread/159421?ContentTypeID=1</link><pubDate>Wed, 28 Nov 2018 13:53:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39368621-071a-4a0e-bf26-ce1de9fe1e14</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;All these defines are defined in the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.2.0/group__nrf__saadc__hal.html"&gt;SAADC HAL&lt;/a&gt; file (nrf_saadc.h - located in&amp;nbsp;modules\nrfx\hal\nrf_saadc.h in SDK 15.x.0). The defines used in this file is mostly found in the MDK (modules\nrfx\mdk\nrf52_bitfields.h). The MDK defines refer to the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/saadc.html?cp=2_1_0_36_10#topic"&gt;registers and register bit&lt;/a&gt;fields.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/thread/159396?ContentTypeID=1</link><pubDate>Wed, 28 Nov 2018 11:16:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e01d725-85e9-49f6-98c4-9f216024c7c1</guid><dc:creator>paul_tanner</dc:creator><description>&lt;p&gt;Thx&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;As you may have guessed I did not locate the definition of&amp;nbsp;&lt;/span&gt;NRF_SAADC_INPUT_AIN0&lt;span&gt;.&amp;nbsp; I still have not but amm using PO.02 now.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I&amp;#39;m now getting sensible values in the region of -9&amp;nbsp; (avg) when grounded and&amp;nbsp;&lt;/span&gt;&lt;span&gt;about 813 (avg) when connected to VDD&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;To convert, I am reading that I need to multiply by&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;pre class="pre codeblock"&gt;* GAIN/REFERENCE * 2^RESOLUTION&lt;br /&gt;&lt;br /&gt;This doc should probably say &lt;br /&gt; * GAIN/(REFERENCE * 2^RESOLUTION)&lt;br /&gt;&lt;br /&gt;Given this NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);&lt;br /&gt;&lt;br /&gt;Gain = &lt;strong&gt;presumably&lt;/strong&gt; 6 (NRF_SAADC_GAIN1_6)&lt;br /&gt;&lt;br /&gt;Reference &lt;strong&gt;presumably&lt;/strong&gt; about 4v (can&amp;#39;t find NRF_SAADC_REFERENCE_INTERNAL)&lt;br /&gt;&lt;br /&gt;Resolution = SAADC_CONFIG_RESOLUTION 1 = 10 bit&lt;br /&gt;&lt;br /&gt;.. which would put VDD at 1.19v (multimeter tells me it&amp;#39;s 2.85)&lt;br /&gt;&lt;br /&gt;So I conclude we&amp;#39;re almost there but I need to locate the definitions for the other 2 constants.&lt;br /&gt;Thx for pointing me to these.&lt;/pre&gt;
&lt;pre class="pre codeblock"&gt;&lt;sup class="ph sup"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/sup&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SAADC on nRF52-DK unexpected result</title><link>https://devzone.nordicsemi.com/thread/159385?ContentTypeID=1</link><pubDate>Wed, 28 Nov 2018 10:23:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4375c03a-ab68-4eb7-81e9-c3d9305e56ae</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;P0.03 is AIN1. If the application is setup to sample AIN0, you need to ground P0.02 to see the desired behavior. Note that the markings in parenthesis on the DK is related to Arduino form factor and not to the nRF pinout. Please have a look at the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/pin.html?cp=2_1_0_3#pin_assign"&gt;nRF52832 Pin assignment documentation&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>