Skip to content

Analog pins A6 and A7 are not usable as GPIO on ATmega168/328 #2584

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oscherler
Copy link

On the ATmega168 and ATmega328[P], pins ADC6 and ADC7 are different from the other ADC pins: they are not part of any port, and therefore are only usable as analogue inputs, not as GPIO. It can get very confusing when you try to configure them as INPUT_PULLUP on the Arduino Nano, for example. I know I was, and that I’m not the only one.

This is visible on the block diagram in the microcontroller datasheet (it’s identical for both the 168 and the 328.) Notice how ADC[6 to 7] at the bottom right bypasses any Port block:

image

I initially just wanted to open an issue, or make a simple PR with a warning about the ATmega168 and ATmega328[P], but I got nerd sniped and ended up investigating all the boards mentioned in the docs to check which were being affected. Hopefully I didn’t make any mistakes.

Moreover, while examining the schematics of all the boards with the affected MCUs, I noticed that the schematics for the Arduino Diecimila and Arduino Duemilanove feature an ATmega8 instead of the ATmega168 mentioned on their respective pages. I’m not submitting any change regarding this in this PR.

What This PR Changes

This PR updates the Analog Input Pins page to include a generic warning about pins A6 and A7 right where it says “the analog pins may be used for GPIO,” and a caveat at the end of the page that lists the affected boards I could identify, which are:

  • Arduino Nano
  • Arduino Mini 05 (with ATmega168, Arduino Mini 03 and 04 use an ATmega8 and are not affected)
  • Arduino Pro Mini
  • Arduino BT (analog inputs A6 and A7 are available on JP1)
  • Arduino Fio

The other boards with these MCUs don’t appear to have A6 and A7 routed to pin headers.

Moreover, it fixes the number of analogue input pins on the documentation page for the Arduino Pro Mini. It has 8 analogue inputs, 4 on the headers on the edge of the board, and 4 on holes in the interior of the board.

Contribution Guidelines

@CLAassistant
Copy link

CLAassistant commented Jul 30, 2025

CLA assistant check
All committers have signed the CLA.

@oscherler oscherler force-pushed the atmega168-328-adc67-fix branch from e77098c to a06d0a9 Compare July 30, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants