Some notes regarding the use of Atmel microcontrollers.
When using the ADC, note that clock speed of the system can cause interesting things to happen, typically when 10-bit resolution is wanted. If the speed is too high, the system cannot perform 10-bit measurement and will always return an hardcoded response. If the measurements seem to fail, reduce clock speed.
Refer to product documentation for details.
By default the JTAG and PDI interfaces are active, which cause interesting problems when trying to program the device with PDI due to interference from JTAG. As result, AVRdude? will fail to get clean connection to the device even if wiring is properly connected. To avoid this issue, connect a 100Kohm resistor between PDI data and ground. After this the JTAG interface can be disabled from the device fuses which in turn should remove the problem.