ADC Results Vary Reset to Reset, with NVM Stored Calibration

cancel
Showing results for 
Search instead for 
Did you mean: 

ADC Results Vary Reset to Reset, with NVM Stored Calibration

257 Views
Contributor I

I am using a MKE18F512VLH16 MCU. Currently I am using two of the three ADC's.  ADC0 and ADC2.

I used the ADC12_DoAutoCalibration function, provided by NXP, to calibrate each of the ADC's.  When I got conversion results that I liked, I stored the calibration of each ADC into FlexRAM.  When the system comes out of reset, the ADC will use those calibration coefficients.

However, I noticed that ADC2 does not seem to give me consistent results when using a stored calibration.  ADC0 is better but still not perfect.  The results are consistent when the system is running.  It's just that they are different then the last reset.

I read that the ADC needs to be calibrated every time it starts up.  So I added a call to do one auto calibration before re-calibrating it to the stored NVM calibration.  This did not help.  I still see a fairly egregious difference in the results.

I was able to track some results across resets.  Ch1(Blue) is for ADC0, and Ch5(Orange) is for ADC2.  The two different graphs show two different duty cycles for the PWM which drives some circuitry, which is fed into the ADC.  The point isn't to see the difference in the two channels, but how the voltages of each ADC change over reset to reset.

 pastedImage_1.png

pastedImage_3.png

I am wondering why I see such variations in results, and also why ADC0 seems to perform better then ADC2?  They both use stored calibrations.  I would also expect them to be consistent across resets.

I wanted to start a discussion to see if anyone could help with this issue.

0 Kudos
3 Replies

78 Views
NXP TechSupport
NXP TechSupport

Hi Sean,

 

A lot of factors can interfere in the ADC accuracy, such as voltage reference, PCB layout, impedance of the analog source, temperature and many more.

 

There are a few recommendations I could give you to try to increase the ADC accuracy, please see them below:

 

-Compensate offset and gain errors by using the Kinetis ADC self-calibration feature or by microcontroller firmware.

-Eliminate the analog-input signal noise.

-Reduce the noise produced by crosstalk by shielding the analog signals by placing a ground track between signals.

-Try to compensate the temperature drift.

 

Please check the below document for more information about increasing ADC accuracy.

https://cache.nxp.com/docs/en/application-note/AN5250.pdf

 

In addition, there is also an application note that explains ADC calibration in more details.

https://www.nxp.com/docs/en/application-note/AN5314.pdf

 

Have a great day,
Felipe

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

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

78 Views
Contributor I

Hi Felipe,

Thank you for taking the time to look at this.

A few things about the recommendations that you gave:

1. Compensate offset and gain errors by using the Kinetis ADC self-calibration feature or by microcontroller firmware.

- Initially, this is what we were doing, but the variation of results produced big differences of ADC results from reset to reset.  We got around this by storing the entire calibration of the ADC into FlexRAM.  This way on start up, it would use the same calibration, and hopefully give us the same accuracy.  This helped.  We were seeing less egregious differences in the ADC results, but still we see different ADC results every other reset or so. 

2. Eliminate the analog-input signal noise.

- We do try our best to eliminate as much noise as possible.  We have an algorithm that takes the average of the signal to try and factor out noise.

3. Reduce the noise produced by crosstalk by shielding the analog signals by placing a ground track between signals.

- We are shielding.

4. Try to compensate the temperature drift.

- The room climate is constant.  We are not doing anything to the system that would affect the temperature.

One thing that is puzzling, is the difference between ADC0 and ADC2.  ADC0 seems to perform much better then ADC2.

The results once the system is running is very consistent.  The issue just seems that something changes every time we turn the system off, and on again.  Again, both ADC's have unique calibrations that are stored in FlexRAM.  Other then the ADC registers, are there any others registers or variables that we are not storing into NVM that could be messing with the results?

0 Kudos

78 Views
NXP TechSupport
NXP TechSupport

Hi Sean,

 

It is mandatory to calibrate the ADC after each system reset including power on reset. Failing to calibrate the ADC after each system reset can result in inaccuracy in the ADC conversion results. Please make sure you wait until reference voltage (VREFH) has stabilized before you execute calibration.

 

Regards,

Felipe

0 Kudos