I am working on an application using ATmega328p atmel microcontroller. I started with the 28 PDIP version, but now I want to use the 32 TQFP, which I noticed has 2 extra inputs after compiling my Altium project.

These inputs are ADC7:6 which "serve as analog inputs to the A/D converter. These pins are powered from the analog supply and serve as 10-bit ADC channels," according to the datasheet.

I have read online that some people have got unknown results when they use the ADC and have floating inputs. What I read they've done is activate pull-down resistors, but I do not see how to configure them (since they do not belong to an I/O port). Also, my application does not even use the A/D converter at all.

What are the best practices? Should I connect an external pull-down resistor? Ignore Altium error?

-

ADC6 and ADC7 are a special case. They do not have any digital input or output buffers connected to them, so they will not create noise or draw excess current like the other pins on the chip might if not handed appropriately. In other words, you can leave them floating and they shouldn't abnormally affect your design.

They also do not have any internal pull ups or pull downs, so if you do plan to tie them up or down, you will have to do so externally.

Since they can never be outputs, though, there is no additional safety or protection in using a resister versus connecting them directly to VCC or GND. If you are still worried about floating analog inputs, you can simply tie ADC7 to the GND pin adjacent to it, and ADC6 to AVCC (or AREF if you prefer).

The sample and hold capacitor is tiny, so if you do decide to follow the purge recommendation, you can use ADC7 to sample - the capacitor will drain very quickly to ground and you will gain the benefits described.

-
I was worried about them having any other functionality like the rest of I/O pins, but you are right, since they are not, I should take the option of leaving them floating. And also, because I am designing the final version of the application and I know the ADC will never be used. – esal26 Jul 12 '14 at 16:31
Where did you find that ADC6 and 7 are "special"? I can't verify from the data sheet that those inputs are any different from the others. – Rev1.0 Jul 8 '15 at 8:12
@Rev1.0 There are many places in the datasheet that show this. Probably the most obvious is the last sentence in 24.9.5 : "Note that ADC pins ADC7 and ADC6 do not have digital input buffers, and therefore do not require Digital Input Disable bits." Also note the block diagram in 2.1 which shows ADC[6..7] going straight to the ADC, while the other 6 ADC ports are shared with PORTC, and the pinouts in Fig 1-1 show ADC6 and ADC7 have no shared functions. – Adam Davis Jul 8 '15 at 12:45
Oh my fault, I was looking at the 324/644 data sheet. This is the first Atmel controller where I see this "specialty". – Rev1.0 Jul 8 '15 at 13:36

A pull-down resistor is good, yes. Not only does it stabilize the inputs and prevent any excess current draw, but it has the hidden benefit that you can use them as a Sample and Hold capacitor purge device. If you read an analogue value from one of these extra inputs in between readings from your other inputs it can make your readings a little more stable as the sample and hold capacitor will be always starting from the same level.

The smaller the resistor the faster the capacitor will discharge, but the higher the outrush current. Something around 470Ω is good. Also protects against the pin ever being configured as an output and driven high.

-
Wait so if I do 1) Read actual analog value 2)Read pulled-down analog, my actual analog value will be less noisy or something? – Funkyguy Jul 11 '14 at 15:48
It will be less influenced by the readings from other channels. Read channel 1, read spare channel, read channel 2, read spare channel, etc. – Majenko Jul 11 '14 at 15:50
Whoaa, thats so sweet! – Funkyguy Jul 11 '14 at 15:50
Extreme example with floating inputs: forum.arduino.cc/index.php?topic=182446.0 – Majenko Jul 11 '14 at 16:02
I see, although I am unfamiliar with the sample and hold cap, it makes sense to fully discharge it and start sampling each time from the same reference point. Great idea. – sherrellbc Jul 11 '14 at 16:06