I've got a 32-pin ATMega328 on a breadboard. I have its analog pin #6 as an input pin from another IC on my board. The IC sends data to this analog pin.
Now, the ATMega328 DIP package (used on the Uno, and other default arduino boards), has 28 pins (instead of 32), and only 6 analog pins (numbered 0-5) total.
I don't get any complaints from the compiler, and am able to upload code successfully to the arduino.
I bootloaded the board using optiloader.
Using my scope, I expect to see signals coming from the IC, but I just see a flat-line signal. My guess is that, by choosing 'Arduino Uno' as my board from within the Arduino IDE, the code dealing with setting up the analog pin 6 is ignored, because the compiler assumes there is no analog pin 6 on this board. Therefore, the analog pin is automatically just pulled down to zero, and any variations in voltage coming from the IC output pin are brought down to 0 by virtue of being connected to analog pin 6.
I tried switching the board I use from the Uno to the Nano (with ATMega328), since the Nano actually runs on the same 32-pin SMT package I'm using.
But now I can't get even the most basic sketch to upload to the board. I tried selecting a few other boards from the menu in the Arduino IDE, and am unable to upload code using any selection besides the Uno.
I'll keep hacking away and researching. Any solutions popping out?
analogRead()source code in github.com/arduino/Arduino/blob/master/hardware/arduino/cores/…, I don’t see any overzealous validation that would prevent ADC6/7 from being usable even in a 6 analog input board configuration. \$\endgroup\$