<?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>AIN2: Switch between ADC and LPCOMP, AIN4: Battery</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9496/ain2-switch-between-adc-and-lpcomp-ain4-battery</link><description>Situation: 
We are building BLE device that have GATT service showing a analog sensor value.
AIN2 is connected to the sensor. AIN4 is connected to battery.
We would like to stop BLE advertising while the sensor value continue to be low, and restart</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 30 Sep 2015 08:12:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9496/ain2-switch-between-adc-and-lpcomp-ain4-battery" /><item><title>RE: AIN2: Switch between ADC and LPCOMP, AIN4: Battery</title><link>https://devzone.nordicsemi.com/thread/35053?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 08:12:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:222089e2-8f23-499e-87ea-9fa53a403304</guid><dc:creator>R. Kawajiri</dc:creator><description>&lt;p&gt;I did not understand here.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;The higher of the two input voltages will be input to both LPCOMP and ADC.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Now, it is very clear. Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AIN2: Switch between ADC and LPCOMP, AIN4: Battery</title><link>https://devzone.nordicsemi.com/thread/35052?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2015 07:46:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35f2bed4-6b84-4922-90ff-412a5cd8b620</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;You observation is as expected. The LPCOMP and ADC share the MUX for the analog input pin, therefore you can not configure LPCOMP and ADC on an analog pin at the same time. In the &lt;a href="https://devzone.nordicsemi.com/question/22244/can-i-really-not-use-lpcomp-and-adc-at-the-same-time/"&gt;linked thread&lt;/a&gt;, what I observed is that you can monitor the supply votlage of the chip with the ADC while using the LPCOMP at the same time on an analog input pin. To monitor the supply voltage with the ADC, you need to configure it as in &lt;a href="https://github.com/NordicSemiconductor/nrf51-ADC-examples/blob/master/rtc0-triggering-adc-sample/main.c"&gt;this example&lt;/a&gt;, i.e. with&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;/* Configure ADC - set reference input source to internal 1.2V bandgap */
NRF_ADC-&amp;gt;CONFIG = (ADC_CONFIG_REFSEL_VBG &amp;lt;&amp;lt; ADC_CONFIG_REFSEL_Pos);
/* Configure ADC - set input source to VDD/3 */
NRF_ADC-&amp;gt;CONFIG |= (ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling &amp;lt;&amp;lt; ADC_CONFIG_INPSEL_Pos);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Note: you may need to use another syntax to configure the ADC in the same way if you use the nrf_adc driver in the latest nRF51 SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>