[SOLVED] AVR input pin drawing 33ma. Why?

My project has an Atmega1284p chip. I've set the physical pin 27 to be input with

This works, as I can see the output from
switch between "1" and "0".

But the input is drawing 33ma when receiving a low signal. How can this be? The input impedance should be extremely high, shouldn't it? I didn't find a value for it in the datasheet, but did find the analog inputs are > 10 Meg ohms.

My best guess is that another function of the pin is turned on in the sketch, and need to be turned off.

I tried two other input pins, setting them as inputs, but got the same results (about 33ma being drained).

What is going on?

Drained from where, to where? Please show a schematic.

Something weird is going on.

What is a high signal ? Is it higher than VCC ?
Are you sure that both VCC and AVCC are connected to 5V ? and both GND are connected to ground ?

The imput impedance is more like 500M.
If the chip is not damaged, then there must something else that sets it as output and low.
It might be shortcut in the circuit board.

Drained from where, to where?

Oops. I had said HIGH when I meant LOW. I connected a 100 ohm resistor between the pin and ground, and measured 3.27v across the resistor.

Something weird is going on.

Thanks for all the good suggestions. I followed them, which ruled out a lot of possibilites.

Then I did a reset of my sketch and discovered the low impedance problem didn't appear until the setup() function was executing, proving the problem was in my sketch.

Then I went to the setup() fumciton, and paused between each line, counting the lines, until the problem occurred. It was the line "DDRC = B11111111;", a leftover from a configuration where the entire register needed to be HIGH, but no longer needed at all. Removing that line fixed the problem.

Yeah, leftovers can be full of bad things which are no good for you health.