<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: LPC1768 ADC Reads Garbage in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524305#M6941</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Dave on Thu Mar 21 11:07:48 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;and which microcontroller are you using?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:08:04 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:08:04Z</dc:date>
    <item>
      <title>LPC1768 ADC Reads Garbage</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524302#M6938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by melpel on Wed Mar 20 15:01:48 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Unable to get the ADC to read anything but garbage.&amp;nbsp; Started with the test code on my board, changed boards, went back to the Keil board... all do the same thing.&amp;nbsp; What am I missing...?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fault Symptoms:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Typically reads back 0 or FFF.&amp;nbsp; When adjusting the analog control on the eval board there was a small range where the values would bounce around randomly, then flop to the other extreme.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On my board if I hard ground the analog input I get 0, otherwise any slight value on the pin reads FFF.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The key steps I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp; LPC_SC-&amp;gt;PCONP |= ADC_PCONP_BIT;// Set global ADC Power Enable&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. LPC_ADC-&amp;gt;ADCR = adcChan | adcClk | adcBurst | adcPdn | adcEdge;&amp;nbsp; // Edge = Burst = 0&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Trigger Read:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3.adcStatus = LPC_ADC-&amp;gt;ADGDR;// Dummy read to clear overrun bit if set&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;4.LPC_ADC-&amp;gt;ADCR |= ADC_STARTCONV;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;5.while ((LPC_ADC-&amp;gt;ADGDR &amp;amp; CONV_COMPLETE_FLAG) == 0);&amp;nbsp;&amp;nbsp; /* Bit 31 is the done bit, set to 1 when conversion is complete */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Read value:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6.avalue = (LPC_ADC-&amp;gt;DR[chan] &amp;gt;&amp;gt; 4);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;6.b//value = (LPC_ADC-&amp;gt;ADDR &amp;gt;&amp;gt; 4);&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:08:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524302#M6938</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:08:02Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 ADC Reads Garbage</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524303#M6939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Dave on Thu Mar 21 08:51:41 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Where do you set the pin functions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:08:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524303#M6939</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 ADC Reads Garbage</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524304#M6940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by melpel on Thu Mar 21 09:04:50 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried multiple methods of pion configuration, makes no difference.&amp;nbsp; Also have gone back to reverify the pin configuration by reading back the PINSEL[n] registers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One thing that is not clear is whether the PINMODE[n] and pin direction FIOxDIR registers require setting or not.&amp;nbsp; I set them to no pull up/down just in case.&amp;nbsp; Based on the PINSEL documentation this should be set automatically when selecting non-GPIO function.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Fault mode update:&amp;nbsp; What I am seeing is 0x0FFF for input &amp;lt; 2V, stray values for 2- ~2.3V, and 0x0000 for Vin &amp;gt; 2.3V.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The clean code style:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT0, 24, MODE1);// ADC0.1 on P0.24&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT0, 25, MODE1);// ADC0.2 on P0.25&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT0, 26, MODE1);// ADC0.3 on P0.26&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT1, 30, MODE3);// ADC0.4 on P1.30&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT1, 31, MODE3);// ADC0.5 on P1.31&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT0, 3, MODE2);// ADC0.6 on P0.3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;configAdcPin(PORT0, 2, MODE2);// ADC0.7 on P0.2&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And the brute force:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; // 3. Set Pins&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINSEL0 &amp;amp;= ~0x000000F0;/* P0.2~3, A0.6~7, function 10 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINSEL0 |= 0x000000A0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINSEL1 &amp;amp;= ~0x003FC000;/* P0.23~26, A0.0~3, function 01 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINSEL1 |= 0x00154000;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINSEL3 |= 0xF0000000;/* P1.30~31, A0.4~5, function 11 */&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; /* No pull-up no pull-down (function 10) on these ADC pins. */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINMODE0 &amp;amp;= ~0x000000F0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINMODE0 |= 0x000000A0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINMODE1 &amp;amp;= ~0x003FC000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINMODE1 |= 0x002A8000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINMODE3 &amp;amp;= ~0xF0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LPC_PINCON-&amp;gt;PINMODE3 |= 0xA0000000;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;No difference either way...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:08:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524304#M6940</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 ADC Reads Garbage</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524305#M6941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Dave on Thu Mar 21 11:07:48 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;and which microcontroller are you using?&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:08:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524305#M6941</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 ADC Reads Garbage</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524306#M6942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by melpel on Thu Mar 21 15:04:15 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;UPDATE:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Working with Keil they suggested running the "Blinky" code on the eval board.&amp;nbsp; Once I got my flash download tools properly configured, this code worked.&amp;nbsp; When ported back into my design the code failed same as before.&amp;nbsp; Changed my design to run from Flash, and the code worked.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So the core problem is "ADC values inop when running from RAM - Flash OK".&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've previously tried manipulating the clock rates assuming that was the problem, but made no difference.&amp;nbsp; Any suggestions as to what to look for next in terms of why the ADC does not operate when running from RAM, but works fine running from flash?&amp;nbsp; &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:08:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524306#M6942</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:08:05Z</dc:date>
    </item>
    <item>
      <title>Re: LPC1768 ADC Reads Garbage</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524307#M6943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by amar on Thu Mar 21 21:56:50 MST 2013&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I am new for the linux device drivers please help me....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;how to read and write to a port pins of the LPC1788 cortex-m3 processor pin..? I have done hello word device driver but now I want to access the port pins and read/write the port pins to control some hardware device with my controller.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;suppose i want to blink an LED at some particular port pin of the hardware, how to achieve this and what all the changes need to made in file system.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;please explain me in detail.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:08:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC1768-ADC-Reads-Garbage/m-p/524307#M6943</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:08:05Z</dc:date>
    </item>
  </channel>
</rss>

