Analog pins give ok digitalRead but peg to 5V on analogRead

I recently began working with an Arduino Mega 2560. It worked briefly, but when developed issues with the analog pins. As far as I am aware, I didn't short anything or otherwise improperly wire the arduino.

If I call an analogRead on any of the analog pins, the value 1023 is returned. This is true whether the pin is floating, tied to ground through a resistor tied to ground with no resistor, or tied to the 3V3 rail. Connecting with a potentiometer doesn't result in a change either.

A digitalRead still gives appropriate values - 0 if the applied voltage is low, and 1 if it's high. Confirmed both by tying the pins to 5V and then to GND, and by connecting a potentiometer and varying it.

My sketch is as follows:

int value;

void setup() {

void loop() {
  value = analogRead(A0);

I have verified that the sketch and wiring are correct by testing them on an Arduino UNO that I have lying around.

I have attempted to label the A0 pin on the Mega as INPUT with no effect.

This is true for all analog pins on the Mega.

Please help me understand what's going on. I suspect the board may be bricked because I haven't been able to find any resources on this, but I would much prefer that not be the case. Any help would be much appreciated.

Anything connected to AREF? Was anything in the past? (If you have external voltage on AREF, but call analogRead() without setting analogReference to external, it can damage the ADC)