I'm puzzling over a simple problem. I'm sure I miss something. I have a ATXmega32A4 running the internal oscillator @ 32 MHz. On AREF/PA0 there is a voltage reference of 2,048 mV and there are 3 voltages on ADC1..3.
The values read are not consistent with the measured voltages.
I'm using a debugger so I will report the *actual* registers content:
PORTA.DIR = 0x00; all inputs PORTA.PINxCTRL = 0x00; totem pole (voltages outs from o.a.) CTRLA = 0x01; ADC enable CTRLB = 0x00; 12-bit, right adj REFCTRL = 0x20; vref on port A EVCTRL = 0xC6; sweep ch 0,1,2,3 syncsweep PRESCALER = 0x04; /64, I tried other values EVSYS.CH0MUX = 0xC0; timer0 ovf (fires @ 100 Hz)
Now the values read:
ADC0 2,048 mV (vref) read: 176 ADC1 6.4 mV read: 1275 ADC2 555.8 mV read: 364 ADC3 98.5 mV read: 882
That doesn't make sense to me.
What should I double check?