How to make ADC counts "stable" in K20/K22 MCU ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to make ADC counts "stable" in K20/K22 MCU ?

2,076 Views
hemant2007
Contributor I

Hi all,

I am using ADC in K20/K22 MCU. I see that if I give voltage input to ADC from calibrator then ADC raw counts vary above and below certain point. This variation is +- 100 counts of ADC on full scale. Though this is accurate, I want some "stable" reading. So how can I proceed ???

In k20/k22 adc initialization averaging is on (32 / 64 samples).

I want to make stable count without using averaging in software.

How Can i achieve this ?? 

For my application this is must.

Also

I have observed that for K20/K22 MCU, raw counts of ADC gets drifted for 200-300 counts if we change MCU temperature from 0 degrees  to 60 degrees..

What is temperature drift of ADC???

Where it is specified in Datasheet ???

Thanks for reading.

Have a nice day!!

-Hemant Undale

Tags (3)
0 Kudos
6 Replies

945 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

There is an application note AN4373 about how to get more accuracy ADC measurement of Kinetis ADC module.

More detailed info, please check below link:

http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4373.pdf

As you mentioned ADC module do calibration before measurement, please check below suggestions how to get more better performance:

*All digital I/Os should be silent,

*Unnecessary modules should be disabled

*VREFH should be stable and high voltage as possible (higher ADC code widths)

*isolated VREFH would be an ideal

*The ADC clock should be as noise free as possible (low jitter – PLL, FLL, OSC)

*Hardware averaging should be set to maximum (32 samples)

*Low power conversion should be disabled

*Do the calibration at room temperature

So far, Kinetis datasheet without ADC module temp drift refer info.

The ADC measurement temperature drift also could be affected by ADC reference voltage, please check the ADC reference voltage value during the measurement.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

945 Views
hemant2007
Contributor I

Hi Hui_Ma,

Yesterday I read AN4373.pdf and did some calculations as per it. Externally I connected R(in)=1000 Ohm and C(in)=1uF...... My unit is calibrated. Vref =1.25 volts and Vin = 500mv  Then ideal count of ADC would be = 26214. But practically I found that adc counts fluctuated between + - 30 counts above and below that count. Then as  I keep this set up ON for 1-2 hours then adc count fluctuates between  + - 100 counts above and below that value which is unacceptable to me. Why this is happening ? Ambient temperature is 25 to 27 Deg C fixed.

for my case

T (aquisition time)=1.2usec

Vcc=3.3 V

V(fsr)=1.25 v

N=16

total conversion time 400usec

      SIM_SCGC6 |= BIT_27 ; // Enable ADC0 Clock.

  ADC0_CFG1 = NORMAL_POWER_MODE | BUS_CLOCK_DIV_BY_TWO_AS_IP_CLK | IP_CLK_DIV_BY_EIGHT | LONG_SAMPLE_TIME | ADC_RESOLUTION_16_BIT ;

  ADC0_CFG2 = SET_OF_A_CHANNELS_AS_IP | ASYNCHRONOUS_CLK_OP_DISABLE | NORMAL_CONVERSION_SPEED | TWENTY_EXTRA_CLK_CYCLES ;

  ADC0_SC2  = SOFTWARE_TRIGGER | COMPARE_FUNCTION_DISABLE | DMA_DISABLE | EXTERNAL_REFERENCE ;

     ADC0_SC3  = CONTINEOUS_CONVERSION | HARDWARE_AVERAGE_ENABLE | AVERAGE_THIRTY_TWO_SAMPLES ;

*Unnecessary modules should be disabled => they are disabled

*VREFH should be stable and high voltage as possible (higher ADC code widths) => it is derived from separate IC regulator REF3112

*The ADC clock should be as noise free as possible (low jitter – PLL, FLL, OSC) => How to check ?

*Hardware averaging should be set to maximum (32 samples) => yes it is kept at 32 samples

*Low power conversion should be disabled => yes it is disabled

*Do the calibration at room temperature => yes calibration is done at room temperature.

"Kinetis datasheet without ADC module temp drift refer info " => why ? where can i get that specs ?

How to reduce this effect ? and reduce fluctuations.???

Thanks for patience!!

---Hemant

0 Kudos

945 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi Hemant,

For the chip has run 1-2 hours, it would be better to do ADC calculation again before ADC measurement.

Please try this and check if the result fluctuate will be reduced.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

945 Views
hemant2007
Contributor I

Hi,

I didnot get you

Will you please elaborate?

Thanks

0 Kudos

945 Views
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

Sorry for the previous comments.

What I mentioned above is about recommended run calibration routine again after chip runs 1~2 hours later.

The chip temperature will rise after 1~2 hours working and the temperature drift will affect ADC measurement.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

945 Views
hemant2007
Contributor I

Thank you Hui_Ma, Your answer is really helpful.

0 Kudos