# ADC on Kinetis K20 problem of 7 count step

Question asked by Massimiliano Sturla on Apr 2, 2015

GoodMorning to all,

I'm developing on K20 with KDS 2.0.0 and KSDK 1.1.0

I do many test...I try the 12 and 16 bit mode , with and without continuous mode, with and without internal averaging (for disabling I need to use the HAL because PEx config and PEx high-level have not routine for disable it)

I use the Dithering with about 200mV of amplitude (that is about 50 count on 12 bit).

I use a custom HW for acquire one value of resistence.

I have a problem: I found some problem of not linarity and a "step" of about 7 count on 12 bit (cross the 1024 bit = 2^10 maybe is the crossing of new bit) that is very clarity enabling dithering!

other this problem I found a very not stable acquired value on 12 bit,.

I Calibrate my HW each time (both the ADC internal calibrating and our external HW for translate count to ohm)

And another big problem is that we have not a similar error in all point of the count range but a very strange and variable error!

We use all double for math calc during averaging

On 16 bit with dithering we have a different behaviour: all work right and we have a very stable value and small error.

There are know problem with K20 internal ADC?

there is something that I can do?

This graph shows the variable error of count and ohm between the count / ohm acquired by ADC and the count / ohm extimated with interpolation

I do not have a constant error so a new calibration can't resolve it

Screenshot 1:

http://postimg.org/image/ujwwj7shh

error ( in ohm) using 12 bit (blue) and 16 bit (red).

I do many many many of this graph in different acquisition of 16 bit and different acquisition of 12 bit with different confguration-.

the result is the same: 12 bit is very very very big AND not constant!

You can see the RED error (16 bit) that is a clarity NOT-LINEARITY-ERRO and is above zero before "4" (that are 800ohm, the first calibration point) and belove zero until "11" (that are 1500 ohm, the second calibration point) after that return positive.

the 12 bit error is very big and haven't a typical  distribuition.

(the value of 12 bit are an average of acquire)

Screenshot 2:

View image: Screen Hunter 30 Apr 02 09 26

different try of 12 bit configuration: the error remain the same with the same strange shape of error

Screenshot 3:

View image: Screen Hunter 31 Apr 02 09 27

this graph shows 600 puntual count that are averaged in a 600msec period for calculate a correct value to use.
As you can see the dither moves the count acquired: averaging tham I can have a more precise value.
but... as you can see...there is a
step crossing 1024 bit

Screenshot 4

http://postimg.org/image/yldzovks5

another graph of dithering  with step

Screenshot 5

View image: Screen Hunter 33 Apr 02 09 32

the same graph but crossin another count value: there is no step!

Screenshot 6

View image: Screen Hunter 34 Apr 02 09 32

One of the PEx configuration ( i try many combination of them)

Screenshot 7
http://postimg.org/image/f637vrrhx

Screenshot 8

View image: Screen Hunter 36 Apr 02 09 34

Many Thanks,

Massimiliano