Enabling digital input buffers on AVR ATmega1280 PORTF and PORTK

  atmega, avr, avr-gcc, c++

I’m trying to use PORTF and PORTK (the two attached to the ADC) of an ATmega1280 as digital inputs but PINK and PINF always contain 0x00 no matter what. This seems to be the expected behavior when configuring these ports only as analog inputs and disabling the digital input buffers, but I am actually doing the opposite, setting both ADCSRx registers to 0x00, ACSR to 0x80 (Analog Comparator Disable, even if i don’t think this should affect digital inputs) and each DIDRx to 0x00.

Enabling internal pullups via PORTx doesn’t affect the PINx registers

Is there anything else i am missing needed to enable them? I’ve searched a lot in the datasheet but i can’t find anything else that could help

Here is a snippet of the current registers configuration, after which i continuously read PINx registers and print them to a serial. It is the only thing currently running on the MCU (other than the FreeRTOS scheduler)

ADCSRA = 0x00;
ADCSRB = 0x00;

ACSR = 0b10000000;

DIDR0 = 0x00;
DIDR1 = 0x00;
DIDR2 = 0x00;

DDRK = 0x00;
DDRF = 0x00;

Source: Windows Questions C++