I've been trying to follow the thread below to get my ATXMEGA128A1's ADC functioning.
Unfortunately, I am still having problems. I am running with the 1V reference (I get the feeling around here that it is the only 'safe' way to go). I have tried running both in signed and unsigned mode, and both in differential and single ended mode. I am reading the inputs at the pins of the STK600 with multiple meters.
Here are some of my results:
Signed Differential Error = +6 LSB
Signed Single Ended Error = -25 LSB
Unsigned Single Ended Error = +48 LSB
I think I have a rev. H chip. Here is the backside, (I'm not sure how to tell other than assuming the H represents a rev.H chip)
The rev.H Errata only says a +/-2LSB error when operating at a voltage refernce below 3V.
I have derived the code essentially from the ATMEL App Note. There is a discussion in the above thread that the CAL register is mislabled in AVR Studio. Is that still the case? I have attempted to read the adc with and without adding the calibration offset, and either way it only makes a difference by 2-4 LSB's. Perhaps the offset is much greater, and I'm not reading it right.
The IOX128a1.h file I am using in with WINAVR-20090313 defines the following adc registers. Are these correct at this point? The only reason I ask is there has been a discussion in the previous thead that these are wrong. If I'm not calibrating correctly, maybe that is the problem.
#define ADCA_CAL _SFR_MEM8(0x020c)
#define ADCA_CALCTRL _SFR_MEM8(0x0205)
So my ultimate question is if it is known that these two numbers need to be swapped? And I am also open to any other suggestions as to how to help figure out what I am doing wrong, if anything.
Sorry for the long, somewhat rambling post.