I want to use the PC2 pin on my ATmega164-1284PA series of microcontrollers and it's not working no matter what I do. I even wrote a minimal test case that only sets it as an output and toggles the pin with a one second delay. Not even that works. What's the problem?
I wasted a lot of time on this. You need to disable JTAG with the fuse bits to use PC2, PC3, PC4 and PC5.
According to the datasheet
in reset. When programmed, the input TAP signals are internally pulled high and the JTAG is enabled for Boundary-scan and programming. The device is shipped with this fuse programmed.
This means that for the pins to act as regular pins you need to disable JTAG.