<?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のトピックLPC822 ADC sequence wrong values</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC822-ADC-sequence-wrong-values/m-p/600698#M23321</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem using the sequences of the LPC822.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I select multiple channels to be read in a sequence and I select single step everything is fine and the correct values are read. However when disabling single step one channel (10) &amp;nbsp;gives me wrong values. The incorrect value is consistent though, it wil always be the same incorrect value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone got any idea what this could possibly be? Source code down below. A convertion is triggered manually by the MRT every 100ms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void Init_adc(void)&lt;BR /&gt;{&lt;BR /&gt; /* Power up ADC and enable ADC clock */&lt;BR /&gt; Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_ADC_PD);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Perform ADC calibration */&lt;BR /&gt; LPC_ADC-&amp;gt;CTRL = ADC_CR_CLKDIV((SystemCoreClock / 500000) - 1) | ADC_CR_CALMODEBIT;&lt;BR /&gt; while((LPC_ADC-&amp;gt;CTRL &amp;amp; ADC_CR_CALMODEBIT) != 0); // Wait until the CALLMODE bit clears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Set the ADC clock divider for maximum speed */&lt;BR /&gt; LPC_ADC-&amp;gt;CTRL = ADC_CR_CLKDIV(0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Configure SEQA as to read the current, temperature and voltage */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] = ADC_SEQ_CTRL_CHANSEL(3) | ADC_SEQ_CTRL_CHANSEL(10) | ADC_SEQ_CTRL_CHANSEL(11);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Trigger polarity is positive edge */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] |= ADC_SEQ_CTRL_HWTRIG_POLPOS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Interrupt at end of sequence */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] |= ADC_SEQ_CTRL_MODE_EOS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Enable SEQA */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] |= ADC_SEQ_CTRL_SEQ_ENA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Enable interrupts for SEQA */&lt;/P&gt;&lt;P&gt;LPC_ADC-&amp;gt;INTEN = ADC_INTEN_SEQA_ENABLE;&lt;BR /&gt; NVIC_EnableIRQ(ADC_SEQA_IRQn);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void ADC_SEQA_IRQHandler(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;state.current = CONVERT_ADC_CURRENT(ADC_DR_RESULT(LPC_ADC-&amp;gt;DR[3]));&lt;BR /&gt;state.temperature = CONVERT_ADC_TEMPERATURE(ADC_DR_RESULT(LPC_ADC-&amp;gt;DR[10]));&lt;BR /&gt;state.voltage = CONVERT_ADC_VOLTAGE(ADC_DR_RESULT(LPC_ADC-&amp;gt;DR[11]));&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Oct 2016 20:01:34 GMT</pubDate>
    <dc:creator>miesalex</dc:creator>
    <dc:date>2016-10-03T20:01:34Z</dc:date>
    <item>
      <title>LPC822 ADC sequence wrong values</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC822-ADC-sequence-wrong-values/m-p/600698#M23321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem using the sequences of the LPC822.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I select multiple channels to be read in a sequence and I select single step everything is fine and the correct values are read. However when disabling single step one channel (10) &amp;nbsp;gives me wrong values. The incorrect value is consistent though, it wil always be the same incorrect value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone got any idea what this could possibly be? Source code down below. A convertion is triggered manually by the MRT every 100ms.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alexander&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void Init_adc(void)&lt;BR /&gt;{&lt;BR /&gt; /* Power up ADC and enable ADC clock */&lt;BR /&gt; Chip_SYSCTL_PowerUp(SYSCTL_SLPWAKE_ADC_PD);&lt;BR /&gt; Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Perform ADC calibration */&lt;BR /&gt; LPC_ADC-&amp;gt;CTRL = ADC_CR_CLKDIV((SystemCoreClock / 500000) - 1) | ADC_CR_CALMODEBIT;&lt;BR /&gt; while((LPC_ADC-&amp;gt;CTRL &amp;amp; ADC_CR_CALMODEBIT) != 0); // Wait until the CALLMODE bit clears&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Set the ADC clock divider for maximum speed */&lt;BR /&gt; LPC_ADC-&amp;gt;CTRL = ADC_CR_CLKDIV(0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Configure SEQA as to read the current, temperature and voltage */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] = ADC_SEQ_CTRL_CHANSEL(3) | ADC_SEQ_CTRL_CHANSEL(10) | ADC_SEQ_CTRL_CHANSEL(11);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Trigger polarity is positive edge */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] |= ADC_SEQ_CTRL_HWTRIG_POLPOS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Interrupt at end of sequence */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] |= ADC_SEQ_CTRL_MODE_EOS;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Enable SEQA */&lt;BR /&gt; LPC_ADC-&amp;gt;SEQ_CTRL[0] |= ADC_SEQ_CTRL_SEQ_ENA;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Enable interrupts for SEQA */&lt;/P&gt;&lt;P&gt;LPC_ADC-&amp;gt;INTEN = ADC_INTEN_SEQA_ENABLE;&lt;BR /&gt; NVIC_EnableIRQ(ADC_SEQA_IRQn);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;void ADC_SEQA_IRQHandler(void)&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;state.current = CONVERT_ADC_CURRENT(ADC_DR_RESULT(LPC_ADC-&amp;gt;DR[3]));&lt;BR /&gt;state.temperature = CONVERT_ADC_TEMPERATURE(ADC_DR_RESULT(LPC_ADC-&amp;gt;DR[10]));&lt;BR /&gt;state.voltage = CONVERT_ADC_VOLTAGE(ADC_DR_RESULT(LPC_ADC-&amp;gt;DR[11]));&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2016 20:01:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC822-ADC-sequence-wrong-values/m-p/600698#M23321</guid>
      <dc:creator>miesalex</dc:creator>
      <dc:date>2016-10-03T20:01:34Z</dc:date>
    </item>
    <item>
      <title>Re: LPC822 ADC sequence wrong values</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC822-ADC-sequence-wrong-values/m-p/600699#M23322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alexander,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have chosen to generate ADC interrupts at the end of every sequence of conversions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case you need to clear the SEQA_INT flag by software in the interrupt handler.&lt;/P&gt;&lt;P&gt;You need to set :smileyalert: bit 28 in the LPC_ADC-&amp;gt;FLAGS register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/3036iCABAED7F5B1372AC/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Oct 2016 12:41:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC822-ADC-sequence-wrong-values/m-p/600699#M23322</guid>
      <dc:creator>wernerf</dc:creator>
      <dc:date>2016-10-07T12:41:28Z</dc:date>
    </item>
  </channel>
</rss>

