<?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: LPC5420x ADC reading wrong values in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5420x-ADC-reading-wrong-values/m-p/564160#M16824</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, well I did oversight the fact that ADC0 on OM13077 is used for LED .. So, my code seems to be ok when I connect it to other AD channel.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Aug 2016 19:34:55 GMT</pubDate>
    <dc:creator>gossamer69</dc:creator>
    <dc:date>2016-08-30T19:34:55Z</dc:date>
    <item>
      <title>LPC5420x ADC reading wrong values</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5420x-ADC-reading-wrong-values/m-p/564159#M16823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have set ADC to work in sync mode, enabled clock, peripheral, VREF, VDDA in SYSCON. Set the pin to analog. I am using single step conversion with setting start bit in CTRL.&lt;/P&gt;&lt;P&gt;While my oscilloscope is showing different voltages from input on ADC0, my ADC reads almost the same value all the time, 0xfec.&lt;/P&gt;&lt;P&gt;I have ran the calibration upon initialisation. Do I need to do anything with that value ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;setup:&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt; = LPC_ADC;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_pin&lt;/SPAN&gt; = a_pin;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;LPC_SYSCON-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;PDRUNCFGCLR&lt;/SPAN&gt; |= (1&amp;lt;&amp;lt;10);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;LPC_SYSCON-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;PDRUNCFGCLR&lt;/SPAN&gt; |= (1&amp;lt;&amp;lt;19) | (1&amp;lt;&amp;lt;23); &lt;SPAN style="color: #4e9072;"&gt;//VDDA ad VREF&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;LPC_SYSCON-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;AHBCLKCTRLSET&lt;/SPAN&gt;[0] |= (1&amp;lt;&amp;lt;27) | (1&amp;lt;&amp;lt;13); &lt;SPAN style="color: #4e9072;"&gt;//&lt;/SPAN&gt;&lt;SPAN style="color: #4e9072; text-decoration: underline;"&gt;adc&lt;/SPAN&gt;&lt;SPAN style="color: #4e9072;"&gt; and &lt;/SPAN&gt;&lt;SPAN style="color: #4e9072; text-decoration: underline;"&gt;iocon&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;LPC_SYSCON-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;PRESETCTRLCLR&lt;/SPAN&gt;[0] |= (1&amp;lt;&amp;lt;27) | (1&amp;lt;&amp;lt;13);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;LPC_SYSCON-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;ADCCLKDIV&lt;/SPAN&gt; = 0x01; &lt;SPAN style="color: #4e9072;"&gt;//clock divider&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;CTRL&lt;/SPAN&gt; |= (1&amp;lt;&amp;lt;0);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;LPC_IOCON-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;PIO&lt;/SPAN&gt;[0][29] = 0x120; &lt;SPAN style="color: #4e9072;"&gt;//ADC_0, analog, filter off, invert disabled, mode inactive, od normal.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;CTRL&lt;/SPAN&gt; &amp;amp;= ~(1&amp;lt;&amp;lt;8); &lt;SPAN style="color: #4e9072;"&gt;//sync mode&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;CTRL&lt;/SPAN&gt; &amp;amp;= ~(0x3&amp;lt;&amp;lt;9); &lt;SPAN style="color: #4e9072;"&gt;//clear res&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;CTRL&lt;/SPAN&gt; |= (0x02&amp;lt;&amp;lt;9); &lt;SPAN style="color: #4e9072;"&gt;//10-bit res&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;[0] &amp;amp;= ~_BV(31); &lt;SPAN style="color: #4e9072;"&gt;//disable ADC&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;[0] |= _BV(18); &lt;SPAN style="color: #4e9072;"&gt;//TrigPolarity&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;[0] |= _BV(31); &lt;SPAN style="color: #4e9072;"&gt;//enable ADC&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #0326cc;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;m_port&lt;SPAN style="color: #000000;"&gt;-&amp;gt;&lt;/SPAN&gt;STARTUP&lt;SPAN style="color: #000000;"&gt; = 1;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #4e9072;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;CALIBR&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt; |= (1&amp;lt;&amp;lt;0); &lt;/SPAN&gt;//start calibration&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #931a68;"&gt;while&lt;/SPAN&gt;(IS_BIT_ENABLED(&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;CALIBR&lt;/SPAN&gt;, 0));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Read:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="color: #931a68;"&gt;unsigned&lt;/SPAN&gt; &lt;SPAN style="color: #931a68;"&gt;long&lt;/SPAN&gt; timeout=1000;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #4e9072; font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN style="color: #000000;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;-&amp;gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;[0] |= _BV(&lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_pin&lt;/SPAN&gt;&lt;SPAN style="color: #000000;"&gt;); &lt;/SPAN&gt;//enable ADC channel&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;[0] |= _BV(28);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;[0] |= _BV(26);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #931a68;"&gt;while&lt;/SPAN&gt; (!IS_BIT_ENABLED(&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;DAT&lt;/SPAN&gt;[&lt;SPAN style="color: #0326cc;"&gt;m_pin&lt;/SPAN&gt;], 31)) &lt;SPAN style="color: #4e9072;"&gt;//wait until end of conversion&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;{&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #931a68;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt; (--timeout == 0) &lt;/SPAN&gt;&lt;SPAN style="color: #931a68;"&gt;return&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt; 0;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="font-size: 12px;"&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;SEQ_CTRL&lt;/SPAN&gt;[0] &amp;amp;= ~_BV(26);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 12px;"&gt;&lt;SPAN class=""&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #931a68;"&gt;return&lt;/SPAN&gt; (&lt;SPAN style="color: #0326cc;"&gt;m_port&lt;/SPAN&gt;-&amp;gt;&lt;SPAN style="color: #0326cc;"&gt;DAT&lt;/SPAN&gt;[&lt;SPAN style="color: #0326cc;"&gt;m_pin&lt;/SPAN&gt;] &amp;gt;&amp;gt; 4) &amp;amp; 0xfff;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;/P&gt;&lt;P style="font-size: 11px;"&gt;&lt;SPAN style="font-size: 15px;"&gt;I am using OM13077. VREFP is 3.3v, VREFN is gnd. Internal RC clock is used.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 15px;"&gt;Am i missing something&amp;nbsp;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 27 Aug 2016 18:57:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5420x-ADC-reading-wrong-values/m-p/564159#M16823</guid>
      <dc:creator>gossamer69</dc:creator>
      <dc:date>2016-08-27T18:57:24Z</dc:date>
    </item>
    <item>
      <title>Re: LPC5420x ADC reading wrong values</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5420x-ADC-reading-wrong-values/m-p/564160#M16824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yeah, well I did oversight the fact that ADC0 on OM13077 is used for LED .. So, my code seems to be ok when I connect it to other AD channel.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Aug 2016 19:34:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC5420x-ADC-reading-wrong-values/m-p/564160#M16824</guid>
      <dc:creator>gossamer69</dc:creator>
      <dc:date>2016-08-30T19:34:55Z</dc:date>
    </item>
  </channel>
</rss>

