<?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>What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24159/what-is-the-pin-for-the-battery-voltage-on-nrf52pca1040-dk</link><description>Hello, 
 I would like to instruct my application to read the battery voltage on my nRF52pca1040 DK, I am intending to do so through the SADC. 
 I will feed the board with the battery that is on its botton side, so I was wondering what is the PIN to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 11 Aug 2017 09:51:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24159/what-is-the-pin-for-the-battery-voltage-on-nrf52pca1040-dk" /><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95142?ContentTypeID=1</link><pubDate>Fri, 11 Aug 2017 09:51:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:922ae6e5-6798-451d-96db-e0b2a7ee68f5</guid><dc:creator>ndarkness</dc:creator><description>&lt;p&gt;I have remove the RETURN_IF_ERROR since they give me compilation errors&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95141?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 15:38:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30bdd6e7-77a9-48ed-8432-3905fbe6327e</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;If you are referring to the saadc_config symbol not found, it could be that is just goes out of scope. It&amp;#39;s a chance you could &amp;quot;fix it&amp;quot; by configuring the optimization level in Project Properties(there is &amp;quot;Code Generation Options&amp;quot; under which there is &amp;quot;Optimisation Level&amp;quot;). But if you are not getting any compiler or linking errors, then there&amp;#39;s nothing to fix.&lt;/p&gt;
&lt;p&gt;I also see that you have removed the RETURN_IF_ERROR statements. I recommend checking all error codes with &lt;code&gt;APP_ERROR_CHECK()&lt;/code&gt; in order to detect bugs and errors in your code.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95147?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 12:19:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:929a6091-9cd2-4cf4-8b1c-df17dea1f208</guid><dc:creator>ndarkness</dc:creator><description>&lt;p&gt;just added the pics&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95145?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 12:17:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bed697bd-83c4-424b-bab6-61bcf478cd98</guid><dc:creator>ndarkness</dc:creator><description>&lt;p&gt;Sorry I did a wrong screen shot, I have updated them. The failure seems to happen when calibrating the SAADC. I have updated the pics&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95146?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 12:11:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34df6fd6-d84a-4d9c-b35a-a0217424fb24</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;What do you mean by &amp;quot;SAADC seems to lose the pin referece to VDD.&amp;quot; ? I don&amp;#39;t see anything wrong in the images. After you call &lt;code&gt;nrf_saadc_channel_config_t channel_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(batt_meas_init.adc_pin_no)&lt;/code&gt;, &lt;code&gt;pin_p&lt;/code&gt; in channel_config is set to &lt;code&gt;NRF_SAADC_INPUT_VDD&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95144?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 11:55:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71a932fc-ec7f-488f-8077-43b809caa88b</guid><dc:creator>ndarkness</dc:creator><description>&lt;p&gt;Thanks Sigurd, I have followed your tip and used the &lt;code&gt;nrf_saadc_channel_config_t channel_config = NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);&lt;/code&gt; command, however I don&amp;#39;t know while execution my SAADC seems to lose the pin referece to VDD. I have attached two images on the main post&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95143?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 10:41:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9edb294-3ec8-41a6-aa4d-604ed7384f69</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;The SAADC can be configured to select AIN0 to AIN7 pins, or the VDD pin as input. See the pin map &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/pin.html?cp=2_1_0_3_0#qfn48"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95140?ContentTypeID=1</link><pubDate>Thu, 10 Aug 2017 07:11:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee9ca079-2860-487d-8a1c-46b6668fe172</guid><dc:creator>ndarkness</dc:creator><description>&lt;p&gt;HI Sigurd, thanks for replying&lt;/p&gt;
&lt;p&gt;Would it be possible to configure as well the GPIO to set VDD as input? Thus I would be able to check that my configuration is correct for the GPIOs, if I get the same reading as if I read directly from VDD.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: What is the pin for the battery voltage on nRF52pca1040 DK?</title><link>https://devzone.nordicsemi.com/thread/95139?ContentTypeID=1</link><pubDate>Wed, 09 Aug 2017 17:20:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:550c77ee-7600-4cb9-8334-09fbb72b4f3c</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can configure the SAADC channel with VDD as input. You don’t have to use a GPIO for this.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_saadc_channel_config_t channel_config =
    NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_VDD);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The SAADC result can then be converted into volts, and further calculated into percentage based on a linearized version of the battery&amp;#39;s discharge curve. Take look at how this is done in the saadc_event_handler() function in the e.g. the &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/ble_sdk_app_proximity.html?cp=4_0_3_4_2_2_16"&gt;ble_app_proximty example&lt;/a&gt; in the SDK.&lt;/p&gt;
&lt;p&gt;Code snippet from the example:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;batt_lvl_in_milli_volts = ADC_RESULT_IN_MILLI_VOLTS(adc_result) +
                          DIODE_FWD_VOLT_DROP_MILLIVOLTS;
percentage_batt_lvl = battery_level_in_percent(batt_lvl_in_milli_volts);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>