Electronic – What to do with unused analog inputs


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?

Best Answer

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.