I'm using an ATxmega32A4 and struggling with the ADC. Unfortunately I didn't put an external reference on the circuit, so forced to use either the 1.0V bandgap or VCC/1.6.
I'm using the lower 4 inputs of port A for my 4 analogue inputs to be read by the ADC. Bit 4 of port A is unused and not connected to anything, bits 7-5 are digital control.
I configured as single ended, but signed mode seems to be completely broken. Unsigned mode seems best, but this has an offset voltage that I had to measure using calibration to null out. However, I still get a several percent error drift over temperature.
I've read that differential mode is best (with an external reference, which I don't have), and tie the negative ADC input to ground via the selected input pin.
Here's my question: As pin 4 is unused, Could I configure for differential mode with a gain of 1 (which will make the negative input high impedance), and drive a digital zero onto pin 4 as a ground, then select pin 4 as the negative input of the ADC? I can't mod the PCB to wire in a ground. If this works, would the VCC/1.6 reference be more temperature stable than the bandgap? I've read the bandgap might drift by anything up to +/-5%. My VCC is actually driven by a regulator which is less than 1% drift over temperature, although I may have to calibrate to get an absolute accuracy.