XMega32a4u ADC zero offset - 0V input to ADC returns 203 on 12 bit res?

Go To Last Post
15 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

We are using an Xmega32a4u for a project and when reading some of the inputs which are set to ground, the ADC returns a value of 203. All the ADC inputs seem to have this offset for some reason.

 

We are using the ADC with an external ref on AREFB of 2.5V. It measure around 2.466V in practice.

 

Also, is it possible to cal the reference against the interval 1.1V bandgap reference - we tried but the value comes out at 2.55V instead of 2.46V (this may also be related to the ADC offsat)

Electronic System Design
http://www.esdn.com.au

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Max count of 12 bits is 4096; so a count of 203 is 5% of full-scale; about 120 mV ... 

 

 

EDIT

 

4095

Last Edited: Mon. Jul 10, 2017 - 11:27 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check the datasheet and manual. In single ended mode the ADC has a small offset, typically 0.1V IIRC. This allows it to measure zero crossing. You can either null it out in software or use the ADC in differential mode with the negative input set to GND via the MUX.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When GND is measured in "Single-ended measurement in unsigned mode", the measured value is normal.
Which mode did you set?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Welcome to the rotten Xmega ADC's world.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the replies. Yes, the offset is around 120mV which is a lot when the signal measured is only 5mV.

 

Here are the control registers set:

ADCA.CTRLA = 1; // enable

ADCA.CH0.CTRL = 1;  // single ended

    ADCA.PRESCALER = 3;

ADCA.CH0.MUXCTRL = ch<<3;

 

Looking at the datasheet shows that the GND level is actually 200.

 

Electronic System Design
http://www.esdn.com.au

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Looking at the datasheet shows that the GND level is actually 200.

Correct, the crazy people like me that have used the Xmega's ADC decided that it was good enough in 11 bit mode without too much calibration and other stuff.

 

So does Hefty=Fergus? or another split personality? cheeky

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you want GND to be zero, just use signed mode. Okay, you drop to 11 bits, around 0.6mV/LSB with your reference.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use this in Single-ended unsigned mode.

(measurement value) = (target value) - (GND value)

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, John, Hefty stands for FD with the F being Fergus.

Electronic System Design
http://www.esdn.com.au

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

- (GND value)

And how do you determine GND value? It is NOT 200 all the time, usually around 180 for me.

 

My applications had most useful values around the 100 ADC counts and below and having such a large variation would have stopped me getting approvals and certification for the product.

I wasted a lot of time (like many others) trying to use 12 bits mode.

 

Fortunately 11 bits were enough

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks John, point taken. I have just moved across to 11 bits.

 

I do still have an issue with reading the internal 1.0V reference. The ADC now returns 709 which indicates the 1.0V reference is only 0.85V based on 2.46V on AREFB  (2.46V * 709/2047).

Electronic System Design
http://www.esdn.com.au

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you calibrating the ADC by reading the calibration bytes and stuffing them into the calibration registers during the ADC init?

 

There are lots of fiddling available on the Xmega's ADC like linearity adjustments as well as the calibration, for me the above was enough.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

Last Edited: Wed. Jul 12, 2017 - 01:02 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Of course, it is the measured value of the pin connected to GND.
Is not it a usual way to correct the GND offset?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well, there are calibration values that you are supposed to load yourself, I think they control gain. And on the E5 parts there is even more you can do.

 

At the very least you should load the calibration values from the signature row.