<?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: ADC calibration results vary ?! in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311464#M13429</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author"&gt;&lt;STRONG&gt;&lt;A href="https://community.nxp.com/people/bitsplitter"&gt;bitsplitter&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Thank you very much for your focus on Freescale Kinetis product. I'm glad to provide support for you.&lt;/P&gt;&lt;P&gt;First I don't think the ADC calibration results vary cause ADC sample result display on LCD change &lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;± &lt;/SPAN&gt;2.&lt;/P&gt;&lt;P&gt;In my opinion, configure ADC work in 16 bit mode is the mainly reason that cause this phenomenon, you will find the particular ENOB wthen ADC work in 16 bit single-ended mode and it can't access to 16.&lt;/P&gt;&lt;P&gt;So it's reasonable that it exsit a little difference between several ADC results when ADC sample an same input signal.&lt;/P&gt;&lt;P&gt;Hope my support help.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/43790iBC69EFE66E3086B8/image-size/large?v=v2&amp;amp;px=999" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 May 2014 07:37:33 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2014-05-09T07:37:33Z</dc:date>
    <item>
      <title>ADC calibration results vary ?!</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311463#M13428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all,&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm using Freescale KL3x MCU.&amp;nbsp; Embedded 16-bit A/D converter is capable of performing its own calibration to eliminate offset and linearity problems.&lt;/P&gt;&lt;P&gt;However, I've experienced some problems with this feature.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems that two successive A/D calibrations result in slightly different calibration data. In my application, high resolution measurement is required, so I'm running&lt;/P&gt;&lt;P&gt;A/D converter in 16-bit mode. First thing after reset is to init A/D converter and perform A/D calibration. Afterward, measurement is done in an endless loop and results are being sent to LCD.&lt;/P&gt;&lt;P&gt;I have noticed that if I reset MCU several times in a row least significant digit on the LCD is changing &lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;± &lt;/SPAN&gt;2 although the input value being measured is fixed (comes from very precise source).&lt;/P&gt;&lt;P&gt;This implies that ADC readings vary. Therefore, I've suspected on the A/D calibration procedure.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To investigate this further, I have created simple program that does only A/D convertor init and calibration ... then waits 1 second and does everything again in an infinitive loop.&lt;/P&gt;&lt;P&gt;Calibration results are sent to PC via UART. I've logged this data into txt file (&lt;EM&gt;see attachment&lt;/EM&gt;).&lt;/P&gt;&lt;P&gt;Inside this file, you'll see that every time data is slightly different although the MCU environment (in example: temperature) didn't change.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Here are calibration results from two successive calibrations:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;0 --&amp;gt; ADC0_OFS&lt;/P&gt;&lt;P&gt;47 --&amp;gt; ADC0_CLP0&lt;/P&gt;&lt;P&gt;92 --&amp;gt; ADC0_CLP1&lt;/P&gt;&lt;P&gt;187 --&amp;gt; ADC0_CLP2&lt;/P&gt;&lt;P&gt;372 --&amp;gt; ADC0_CLP3&lt;/P&gt;&lt;P&gt;740 --&amp;gt; ADC0_CLP4&lt;/P&gt;&lt;P&gt;48 --&amp;gt; ADC0_CLPS&lt;/P&gt;&lt;P&gt;33511 --&amp;gt; ADC0_PG&lt;/P&gt;&lt;P&gt;49 --&amp;gt; ADC0_CLM0&lt;/P&gt;&lt;P&gt;97 --&amp;gt; ADC0_CLM1&lt;/P&gt;&lt;P&gt;192 --&amp;gt; ADC0_CLM2&lt;/P&gt;&lt;P&gt;382 --&amp;gt; ADC0_CLM3&lt;/P&gt;&lt;P&gt;755 --&amp;gt; ADC0_CLM4&lt;/P&gt;&lt;P&gt;48 --&amp;gt; ADC0_CLMS&lt;/P&gt;&lt;P&gt;33529 --&amp;gt; ADC0_MG&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;65535 --&amp;gt; ADC0_OFS&lt;/P&gt;&lt;P&gt;49 --&amp;gt; ADC0_CLP0&lt;/P&gt;&lt;P&gt;96 --&amp;gt; ADC0_CLP1&lt;/P&gt;&lt;P&gt;193 --&amp;gt; ADC0_CLP2&lt;/P&gt;&lt;P&gt;385 --&amp;gt; ADC0_CLP3&lt;/P&gt;&lt;P&gt;767 --&amp;gt; ADC0_CLP4&lt;/P&gt;&lt;P&gt;49 --&amp;gt; ADC0_CLPS&lt;/P&gt;&lt;P&gt;33537 --&amp;gt; ADC0_PG&lt;/P&gt;&lt;P&gt;50 --&amp;gt; ADC0_CLM0&lt;/P&gt;&lt;P&gt;100 --&amp;gt; ADC0_CLM1&lt;/P&gt;&lt;P&gt;198 --&amp;gt; ADC0_CLM2&lt;/P&gt;&lt;P&gt;392 --&amp;gt; ADC0_CLM3&lt;/P&gt;&lt;P&gt;776 --&amp;gt; ADC0_CLM4&lt;/P&gt;&lt;P&gt;49 --&amp;gt; ADC0_CLMS&lt;/P&gt;&lt;P&gt;33550 --&amp;gt; ADC0_MG&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have read that calibration results can be affected by the clock source, frequency, power and conversion speed settings, voltage reference, hardware average function, the&lt;/P&gt;&lt;P&gt;sample time and to a much lesser extent, environment. I've followed all the instructions from the datasheet. Here is the relevant code snippet:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;P&gt;uint8_t Init_ADC(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;unsigned short nCal;&lt;/P&gt;&lt;P&gt;uint8_t autocal_result;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Turn on the ADC0 clock&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SCGC6 |= SIM_SCGC6_ADC0_MASK;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; // Select TPM2 as ADC 0 trigger source&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIM_SOPT7 = SIM_SOPT7_ADC0ALTTRGEN_MASK | SIM_SOPT7_ADC0TRGSEL(10);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Normal power configuration&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Input Clock is (Bus Clock)/2&lt;/P&gt;&lt;P&gt;&amp;nbsp; //The divide ratio is 1 and the clock rate is input clock&lt;/P&gt;&lt;P&gt;&amp;nbsp; //ADC clock = 24M/2/4 = 3MHz&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Long sample time&lt;/P&gt;&lt;P&gt;&amp;nbsp; //16-bit conversion&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_CFG1 = 0x5D;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //ADxxa channels are selected&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Asynchronous clock output disabled; Asynchronous clock is enabled only if selected by ADICLK&lt;/P&gt;&lt;P&gt;&amp;nbsp; //and a conversion is active.&lt;/P&gt;&lt;P&gt;&amp;nbsp; //High-speed conversion sequence selected with 2 additional ADCK cycles to total conversion time.&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Default longest sample time; 20 extra ADCK cycles; 24 ADCK cycles total.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_CFG2 = 0x4;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Hardware trigger selected&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Compare function disabled&lt;/P&gt;&lt;P&gt;&amp;nbsp; //DMA disabled&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Default voltage reference pin pair, that is, external pins VREFH and VREFL&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC2 = ADC_SC2_ADTRG_MASK;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Hardware average function enabled&lt;/P&gt;&lt;P&gt;&amp;nbsp; //32 samples averaged&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC3 = 0x7;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Conversion complete interrupt enabled&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Single-ended conversions&lt;/P&gt;&lt;P&gt;&amp;nbsp; //AD4 is selected as input&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC1A = ADC_SC1_AIEN_MASK | 0x4;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* ADC calibration */&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //The input channel, conversion mode continuous function, compare function, resolution&lt;/P&gt;&lt;P&gt;&amp;nbsp; //mode, and differential/single-ended mode are all ignored during the calibration function.&lt;/P&gt;&lt;P&gt;&amp;nbsp; //In 16-bit single-ended mode, there is no field in the OFS&lt;/P&gt;&lt;P&gt;&amp;nbsp; //corresponding to the least significant result D[0], so odd values, such as -1 or +1, cannot&lt;/P&gt;&lt;P&gt;&amp;nbsp; //be subtracted from the result.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC1A &amp;amp;= ~ADC_SC1_AIEN_MASK;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC2 = 0x1; //Enable Software Conversion Trigger for Calibration Process; Alternate reference pair (Vrefh = VDDA).&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC3 |= ADC_SC3_CAL_MASK; //Start calibration&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(!(ADC0_SC1A &amp;amp; ADC_SC1_COCO_MASK));&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if (ADC0_SC3 &amp;amp; ADC_SC3_CALF_MASK)&lt;/P&gt;&lt;P&gt;&amp;nbsp; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Calibration failed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; autocal_result = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp; }else{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Calculate plus-side calibration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal = 0x00;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal =&amp;nbsp; ADC0_CLP0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLP1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLP2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLP3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLP4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLPS;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal = nCal &amp;gt;&amp;gt; 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal |= 0x8000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC0_PG = ADC_PG_PG(nCal);&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Calculate minus-side calibration&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal = 0x00;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal =&amp;nbsp; ADC0_CLM0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLM1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLM2;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLM3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLM4;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal += ADC0_CLMS;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal&amp;nbsp;&amp;nbsp;&amp;nbsp; = nCal &amp;gt;&amp;gt; 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nCal&amp;nbsp;&amp;nbsp;&amp;nbsp; |= 0x8000;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ADC0_MG = ADC_MG_MG(nCal);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; autocal_result = 1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC3 &amp;amp;= ~ADC_SC3_CAL_MASK;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;//Restore original settings&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC1A = ADC_SC1_AIEN_MASK | 0x4;&lt;/P&gt;&lt;P&gt;&amp;nbsp; ADC0_SC2 = ADC_SC2_ADTRG_MASK;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*End - ADC calibration */&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Configure interrupts&lt;/P&gt;&lt;P&gt;&amp;nbsp; //Set Priority 2&lt;/P&gt;&lt;P&gt;&amp;nbsp; // NVIC_IPR3: PRI_1=0x80&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_IPR3 = (uint32_t)((NVIC_IPR3 &amp;amp; (uint32_t)~(uint32_t)(NVIC_IP_PRI_15(0x3F))) | (uint32_t)(NVIC_IP_PRI_15(0x80)));&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_ICPR |= 0x00008000; //Clear any pending interrupts&lt;/P&gt;&lt;P&gt;&amp;nbsp; NVIC_ISER |= NVIC_ISER_SETENA(0x00008000); //Enable ADC0 interrupts&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; return autocal_result;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/BLOCKQUOTE&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would appreciate your opinion on this matter. Have I overseen something or have I reached the limits of A/D converter?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-337531"&gt;adc_calibration.txt.zip&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 May 2014 14:41:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311463#M13428</guid>
      <dc:creator>bitsplitter</dc:creator>
      <dc:date>2014-05-07T14:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: ADC calibration results vary ?!</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311464#M13429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author"&gt;&lt;STRONG&gt;&lt;A href="https://community.nxp.com/people/bitsplitter"&gt;bitsplitter&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Thank you very much for your focus on Freescale Kinetis product. I'm glad to provide support for you.&lt;/P&gt;&lt;P&gt;First I don't think the ADC calibration results vary cause ADC sample result display on LCD change &lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;± &lt;/SPAN&gt;2.&lt;/P&gt;&lt;P&gt;In my opinion, configure ADC work in 16 bit mode is the mainly reason that cause this phenomenon, you will find the particular ENOB wthen ADC work in 16 bit single-ended mode and it can't access to 16.&lt;/P&gt;&lt;P&gt;So it's reasonable that it exsit a little difference between several ADC results when ADC sample an same input signal.&lt;/P&gt;&lt;P&gt;Hope my support help.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/43790iBC69EFE66E3086B8/image-size/large?v=v2&amp;amp;px=999" title="1.jpg" alt="1.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 07:37:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311464#M13429</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2014-05-09T07:37:33Z</dc:date>
    </item>
    <item>
      <title>Re: ADC calibration results vary ?!</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311465#M13430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for your interest in my problem.&lt;/P&gt;&lt;P&gt;I'm running ADC in 16-bit mode. However, I have managed to achieve ENOB ~14 bits after a lot of averaging and that is OK for my application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not outputting ADC readings on the LCD but values (calculated) based on ADC readings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me explain my application in more details.&lt;/P&gt;&lt;P&gt;I'm constructing a voltage measurement device. When I power it up, it first does the ADC init and the ADC calibration... etc. Then it starts measuring applied voltage and displays it on the LCD in an endless loop. Without restarting the measuring device I can do a voltage measurement calibration using a very precise voltage source and then store the calibration data into eeprom. Afterward the device works perfectly accurate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, next time I power up the device it performs the ADC init and ADC calibration again and uses the previously stored eeprom calibration data. However, LCD showings are now slightly different (&lt;SPAN lang="EN-US" style="font-size: 12.0pt; font-family: 'Times New Roman','serif';"&gt;± &lt;/SPAN&gt;2 least significant digits) although the same voltage is applied to the measuring device (again coming from the very precise voltage source).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Therefore, I've concluded that ADC calibration results in varying calibration data and it affects my application badly because of its high resolution measurement (~14bits) requirement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just notice this plus side gain difference coming from two successive ADC calibrations:&lt;/P&gt;&lt;P&gt;33511 --&amp;gt; ADC0_PG&lt;/P&gt;&lt;P&gt;33537 --&amp;gt; ADC0_PG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I make this these two values not differ so much or this is just the way it is?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 09:23:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311465#M13430</guid>
      <dc:creator>bitsplitter</dc:creator>
      <dc:date>2014-05-09T09:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: ADC calibration results vary ?!</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311466#M13431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;SPAN class="j-post-author"&gt;&lt;STRONG&gt;&lt;A href="https://community.nxp.com/people/bitsplitter"&gt;bitsplitter&lt;/A&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Thanks for reply and your explaination.&lt;/P&gt;&lt;P&gt;I'm afraid that you can't use previous calibration result any more after you reset the device. As mentioned in RM,&lt;/P&gt;&lt;P&gt;Calibration must be run, or valid calibration values written, after any reset and before a conversion is initiated.&lt;/P&gt;&lt;P&gt;Regarding to the difference between successive ADC calibration, I'd like to suggest that you'd better let it go and once ADC calibration is ok before ADC work.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 10:59:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311466#M13431</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2014-05-09T10:59:01Z</dc:date>
    </item>
    <item>
      <title>Re: ADC calibration results vary ?!</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311467#M13432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not storing ADC auto-calibration data into eeprom but the voltage measurement calibration data as it should be done once in the production phase.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 May 2014 12:42:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311467#M13432</guid>
      <dc:creator>bitsplitter</dc:creator>
      <dc:date>2014-05-09T12:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: ADC calibration results vary ?!</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311468#M13433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Slavisa Zlatanovic,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I think you may misunderstand my opinion. I mean you should not use previous ADC calibration data for current ADC sample operation.&lt;/P&gt;&lt;P&gt;And calibration must be run after any reset or any configuration of ADC change, however one time is enough.&lt;/P&gt;&lt;P&gt;Hope my support could help.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 03:02:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/ADC-calibration-results-vary/m-p/311468#M13433</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2014-05-12T03:02:56Z</dc:date>
    </item>
  </channel>
</rss>

