<?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>Can&amp;#39;t get a ADC result that makes sense</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5865/can-t-get-a-adc-result-that-makes-sense</link><description>Hi, 
 I&amp;#39;m working on a simple ADC application where I sample using analog channel 1 and then read the value through the debugger. However my results are nonsense. I have connected a potmeter with VDD on the right pin, ground on the left and the analog</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Mar 2015 08:28:44 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5865/can-t-get-a-adc-result-that-makes-sense" /><item><title>RE: Can't get a ADC result that makes sense</title><link>https://devzone.nordicsemi.com/thread/20466?ContentTypeID=1</link><pubDate>Thu, 05 Mar 2015 08:28:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b70a963-f6f0-4d79-8c5e-ab1e30f6a9d6</guid><dc:creator>Nikolaj</dc:creator><description>&lt;p&gt;Thank you very much Vebjørn. I messed up the pins. It&amp;#39;s pretty obvious after a good nights sleep and a big cup of coffee.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't get a ADC result that makes sense</title><link>https://devzone.nordicsemi.com/thread/20465?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2015 15:37:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:05a3561f-8d45-4cab-853c-0ad11e2340bc</guid><dc:creator>Vebj&amp;#248;rn</dc:creator><description>&lt;p&gt;First of all you need to figure out which pin ADC_CONFIG_PSEL_AnalogInput1 is.
If you are using PCA10028 (nRF51 DK) you should check out the Product Specification for the nRF51422 chip: &lt;a href="https://www.nordicsemi.com/eng/nordic/Products/nRF51422/nRF51422-PS/20360"&gt;link&lt;/a&gt;. Scroll down to section 2.2.1.1 for a description of all the pins.
You will see that pin 46, or &amp;quot;gpio&amp;quot; pin P0.27 is used as ADC/LPCOMP input 1. However, we also see that this pin is a connection pin for the external 32kHz crystal (!). If you also check the nRF51 DK User Guide, section 5.4, there is a note saying &amp;quot;P0.26 and P0.27 are by default used for the 32 kHz crystal and are not available on the connectors.&amp;quot; So, unless you follow the guide to make them available, it is not physically possible to connect something to Analog Input 1.&lt;/p&gt;
&lt;p&gt;My advice would be to use a different ADC input, for example ADC_CONFIG_PSEL_AnalogInput2, which is connected to pin P0.01. (P0.01 is clearly marked on the board)&lt;/p&gt;
&lt;p&gt;The numbering can be a bit confusing, but remember to always check the datasheets, since the ADC input pins aren&amp;#39;t really connected in a logical sequence&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't get a ADC result that makes sense</title><link>https://devzone.nordicsemi.com/thread/20464?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2015 15:15:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:328659a2-4c2a-455e-a7e9-acd883dbea25</guid><dc:creator>Nikolaj</dc:creator><description>&lt;p&gt;My code is working and the LED&amp;#39;s are toggling every time i press the button. I think the pin is floating too. You are mentioning pin 27 as being the right pin? I&amp;#39;m having a really hard time figuring out which pins are what. According to the user guide for the PCA10028 board P2 is the analog port and P2 contains P0.01 through P0.06.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't get a ADC result that makes sense</title><link>https://devzone.nordicsemi.com/thread/20463?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2015 14:43:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9eb87f95-3812-4e1f-974a-540c92547b0b</guid><dc:creator>Vebj&amp;#248;rn</dc:creator><description>&lt;p&gt;Anything with 4 spaces in front is interpreted as code. So your code works, except the result is weird? (you can see pin 24 toggle?) It sounds like the ADC pin is floating.. are you sure you have connected the pot to the correct pin? (pin 27). Have you double checked with a multimeter on the pot to see if the voltage varies as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't get a ADC result that makes sense</title><link>https://devzone.nordicsemi.com/thread/20462?ContentTypeID=1</link><pubDate>Wed, 04 Mar 2015 13:57:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:47606593-052e-48ba-b038-59783b5ea99b</guid><dc:creator>Nikolaj</dc:creator><description>&lt;p&gt;How do I make the code look nice in the question btw? The above is pretty messy&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>