AnalogRead always 1023 on Arduino Due? Just using the Basic Example AnalogReadSerial.

// the setup routine runs once when you press reset:
  void setup() 
{
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() 
{
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}


I have a basic voltage divider set up between two 10K resistors from 5V to GND. I have verified with a DMM that the DC voltage at pin A0 is 2.5V. Grounding the A0 pin has no effect.

It also seems that enabling either ADC channel 7 (Arduino pin AD0) or enabling every channel, putting the ADC in free-running mode, and deliberately setting it to not sleep has no effect:

ADC-&gt;ADC_CHDR = 0;
ADC-&gt;ADC_CHER |= 0xFF;
ADC-&gt;ADC_MR |= 0b10000000;
ADC-&gt;ADC_MR &amp;= 0b11011111;


Also, by running the sketch DigitalInputPullup, I can get the LED on pin 13 to toggle and serial communication to work as I tie the pin to ground, demonstrating that the board is being programmed properly.

I guess I'm just stumped. Should be the simplest thing in the world and it's just not working.

EDIT:
This is my attempt at manually controlling the ADC:

volatile unsigned long value;

void setup() 
{
  //ADC setup
  ADC-&gt;ADC_WPMR &amp;= 0xFFFE; //disable write protect
  ADC-&gt;ADC_CHER = 0b100; //Enable AD2     |
  ADC-&gt;ADC_MR &amp;= 0b11111111000000001111111100000000;
  ADC-&gt;ADC_MR |= 0b00000000000100100000000000000000; //software trigger, hi res, no sleep, not free running
  ADC-&gt;ADC_IER = 0b100; //enable interrupt
  ADC-&gt;ADC_IMR = 0b100; //enable interrupt in mask

  ADC-&gt;ADC_CR |= 0b10; //start first conversion
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() 
{
  ADC-&gt;ADC_CR |= 0b10; //start conversion
  while (!(ADC-&gt;ADC_ISR &amp; 0b100)); //wait for conversion to end 

  for (int i = 0; i &lt;= 15; i++)
 { 
    value = ADC-&gt;ADC_CDR[i]; //read conversion data for all channels
    Serial.println(value);    
 }

 Serial.println();
 Serial.println();
 Serial.println();

 delay(3000);
}


Just doesn't seem to be doing anything. ADC_CHSR (the ADC channel status register) shows channel 2 and only channel 2 enabled and conversions are starting and completing, yet now the conversion data is always 2048. Here's the serial output of all 15 channels, now in 12 bit mode:

0
0
4095
0
0
0
0
0
0
0
0
0
0
0
0
0



0
0
4095
0
0
0
0
0
0
0
0
0
0
0
0
0
You need to add this to your setup():

pinMode(A0, INPUT);


...to set the pin for reading.

Since you're reading an input that's already pulled up (in the middle of a voltage divider), that should be all. However, you can turn on the internal pull-up with:

digitalWrite(A0, HIGH);


...while the pin is in input mode.

More details here:

http://arduino.cc/en/Reference/PinMode

http://arduino.cc/en/Tutorial/AnalogInputPins