<?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>LPC MicrocontrollersのトピックRe: 4337 ADC problem with value returned and DONE status</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557714#M15464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by krhodesnb on Mon Feb 03 14:10:10 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This has improved thing, but it still doesn't work as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With 10 bits, and 400kHz sampling rate, 3.3v always returns 1012, which is close enough.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However with 0 volts, it returns 356, which is not what I expected. I would've expected a value closer to 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:41:14 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:41:14Z</dc:date>
    <item>
      <title>4337 ADC problem with value returned and DONE status</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557711#M15461</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by krhodesnb on Thu Jan 30 20:25:58 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I have 2 problems with the ADC:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1) The Chip_ADC_ReadStatus returns that the ADC is ready immediately but the values aren't correct. If I put a 1mSec delay after starting the acquisition, it seems to have a fully calculated value&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2) When the input voltage is 3.3v, the value read is 0 and when the input voltage is about 2v, the value read is 511. This seems inverted. When at 3.3v, it should read the full 10 bits (or 1023) and when at 2v, should be around 511&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Below is the code I'm using, adapted from the 4370 examples and lpcopen 1.03 as there is none for the 4337.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks...Keith&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int i, j;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Initialization&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ADC_Clock_Setup_T ADCSetup;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_ADC_Init(LPC_ADC0, &amp;amp;ADCSetup);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_ADC_Set_SampleRate(LPC_ADC0, &amp;amp;ADCSetup, 4500000);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_ADC_Set_Resolution(LPC_ADC0, &amp;amp;ADCSetup, ADC_10BITS);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;const CHIP_ADC_CHANNEL_T channelIndex[5] = { ADC_CH4, ADC_CH3, ADC_CH5, ADC_CH2 };&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // walk thru each of 4 channels, getting the value of each&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(i = 0;i&amp;lt;4;i++)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// Tell ADC multiplexer which one to sample&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chip_SCU_ADC_Channel_Config(0, channelIndex&lt;/SPAN&gt;&lt;I&gt;);&lt;BR /&gt;Chip_ADC_Channel_Enable_Cmd(LPC_ADC0, channelIndex&lt;I&gt;, ENABLE);&lt;BR /&gt;&lt;BR /&gt;Chip_ADC_Burst_Cmd(LPC_ADC0, DISABLE);&lt;BR /&gt;&lt;BR /&gt;Chip_ADC_Set_StartMode(LPC_ADC0, ADC_START_NOW, ADC_TRIGGERMODE_RISING);&lt;BR /&gt;&lt;BR /&gt;for(j=0;j&amp;lt;MAX_KEYBOARD_CONVERT_LOOP;j++)&lt;BR /&gt;{&lt;BR /&gt;if(Chip_ADC_Read_Status(LPC_ADC0, channelIndex&lt;I&gt;, ADC_DR_DONE_STAT) == SET)&lt;BR /&gt;{&lt;BR /&gt;/* Read ADC value */&lt;BR /&gt;if(SUCCESS == Chip_ADC_Read_Value(LPC_ADC0, channelIndex&lt;I&gt;, &amp;amp;dataADC))&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // prints 0 when value is 3.3v, and 511 when value is 2v&lt;BR /&gt;printf("channel: %d, value: %d\n", channelindex&lt;I&gt;, dataADC);&lt;BR /&gt;break;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Chip_ADC_Channel_Enable_Cmd(LPC_ADC0, channelIndex&lt;I&gt;, DISABLE);&lt;BR /&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:41:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557711#M15461</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: 4337 ADC problem with value returned and DONE status</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557712#M15462</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Fri Jan 31 02:13:06 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Your sample rate is too high.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4.5 MHz is the maximal ADC clock frequency. You need to divide that by the number of clocks needed per sample (11 at 10 bits) to get the maximal sample rate.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:41:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557712#M15462</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: 4337 ADC problem with value returned and DONE status</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557713#M15463</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by krhodesnb on Sat Feb 01 03:47:41 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;OK, that makes sense.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a block diagram available for the ADC operation? Is there any additional addendum aside from what is in the data sheet?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks...&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:41:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557713#M15463</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: 4337 ADC problem with value returned and DONE status</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557714#M15464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by krhodesnb on Mon Feb 03 14:10:10 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;This has improved thing, but it still doesn't work as expected.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With 10 bits, and 400kHz sampling rate, 3.3v always returns 1012, which is close enough.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However with 0 volts, it returns 356, which is not what I expected. I would've expected a value closer to 0.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:41:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557714#M15464</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: 4337 ADC problem with value returned and DONE status</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557715#M15465</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by starblue on Tue Feb 04 03:05:54 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Then there's probably something wrong with your circuit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It worked very nicely for me when I did some tests with the 4350 on an MCB4350 board. I got deviations from the expected ADC value of -3 to 2 LSB. The range was slightly compressed, contrary to what you are seeing. I.e., the ADC value became zero slightly above 0V and 1023 slightly below 3.3V. Linearity was very good, less than one LSB deviation from the best fit line. The sample rate was maxed out for 204MHz IIRC, so also around 400kHz.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:41:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/4337-ADC-problem-with-value-returned-and-DONE-status/m-p/557715#M15465</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:41:14Z</dc:date>
    </item>
  </channel>
</rss>

