ADC accuracy

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

ADC accuracy

1,182 Views
rogerfl
Contributor III

Hello,

 

On K20-50MHz-48pin, I'm working on an ADC implementation based on the example code. I'm simply trying to read two thermistors in a voltage divider circuit. For each thermistor there is a circuit from voltage reference 1.2V -> 10K resistor -> (ADC Test Point) -> thermistor connector -> ground.

 

For testing purposes I selected the voltage reference and the internal temp sensor as my two channels and I get this result:

 

ADC A: 65211, 1.194 V

ADC B: 39329, 0.720 V

 

Those are 0.006/1.2 = 0.5% and .001/0.719 = 0.1% errors.

 

When I configure the same software to read the external pins, with no thermistor connected, I get horrible results. With thermistor connector open, the ADC input should be 1.2V. It is simply connected through the 10K pullup to the reference voltage of 1.2V. However, I get the following:

 

ADC A: 49642, 0.909 V

ADC B: 51216, 0.938 V

 

I measure it with a scope and a DMM and both show 1.2V.

 

Attaching my driver code.  It uses the adc16.c and adc16.h files from the example code.

 

Any ideas?

Original Attachment has been moved to: adc.h.zip

Original Attachment has been moved to: adc.c.zip

0 Kudos
3 Replies

679 Views
paulmartin
Contributor III

Hello Roger

You may have to check the K20 data sheet, but on the chip that I use (K60) you can not have such a high resistor on the input of the ADC. The 10K is higher than the input resistor that loads the internal capacitor for the ADC. Therefore the capacitor does not reach the input voltage in time. You can make the ADC extremely slow, or (which is way better) use an operational amplifier to buffer the input signal. This effectively reduces the 10K input resistor to next to nothing.

Martin

679 Views
rogerfl
Contributor III

Thank you, Martin

According to the data sheet K20P48M50SF0.pdf Table 24, the Input leakage error is I[In] x R[AS] where I[In] is leakage current and R[AS] is the input resistance (10K in my case). I[In] is max 1.0 uA according to same data sheet. So error should be 0.000_001 x 10_000 = 0.01V.  That is exactly what I observe with a digital multimeter, .01 drop across the 10K resistor. That does not explain why I'm seeing 1.2 - 0.9 = 0.3V difference in my reading.

All the examples I can find use the VDDA as the voltage reference (typically 3.3V) rather than using the internal voltage reference 1.2V.  The table 24 I refer to above does say all its data assumes selected reference is VDDA 3.0V, but nothing explains why I see a 0.3V / 1.2V = 25% error.

I even tried Processor Expert ADC component to see if it got better, but it does not support changing the voltage reference to alternate internal voltage reference. And I when I modified the generated code to select it, the results were even much worse.

Keep in mind I have nothing connected to VREFH or VREFL.

Has anyone else tried using this configuration?

Roger

0 Kudos

679 Views
paulmartin
Contributor III

Hello Roger,

I am not so much concerned about the leakage. (As far as I understand the leakage comes from the internal protection diodes)

What I had problems with was the actual source resistance R[AS] being too high in my system. Quote frome the data sheet Table 23 annotation 3:

"

This resistance is external to MCU. The analog source resistance should be kept as low as possible in order to achieve the

best results. The results in this datasheet were derived from a system which has <8 Ω analog source resistance. The R[AS]/C[AS]

time constant should be kept to <1ns.

"

In my test board I used a 10K potentiometer as a voltage divider using the board voltage 3.3V. And the results were all over the place.

You can test wether this matches your problem by using a different voltage source that has very low R[AS] and if you can, avoid using any voltage divider for this test or use one with very low total resistance.

Martin

0 Kudos