Arduino UNO burn bootloader/program to ATmega328 32MLF

Hello,

I know we can burn the bootloader to the external ATmega, but does this procedure apply to 32 pin version of ATmega as well?

Secondly, since there are 4 extra pins in the 32 pin MCU, namely VCC, GND, ADC6 and ADC7. How can I use the Arduino IDE to program those extra two analog input pins( how to map them to a number, like analogRead(2))?

Thanks for any help!

They are not available on the Arduino Uno board, but they are used in the Pro Mini and Nano board. You could make your design compatible with one of those.
Use them as pin A6 and A7. They are only analog input, and are not also digital pins like A0...A5.

int x = analogRead ( A6 ) ;

I did a test once, to see if I could read noise from A6 and A7 from the DIP ATmega328P that doesn't have A6 and A7. That was possible. So those are on the chip inside as well, they just don't have pins to the outside world.

Hi Thanks for your reply.

But how to burn the bootloader to a brand-new ATmega328 32 mlf?

Uno board def should work - wiring_analog.c doesn't seem to do anything to keep you from analogRead()ing A6 and A7 (i've seen some versions of wiring_analog that do). Bootload it like any other uno-alike (assuming you've got the cap and crystal on it - you need a new board def if you don't want to run it off a 16mhz external crystal)

Extra Vcc and Gnd go to... vcc and gnd. Don't forget the decoupling caps. You need 3 0.1uf decoupling caps, one right next to each Vcc/AVcc pin, between Vcc/AVcc and Gnd.

ahh. Thanks for your reply.
I hope to upload the bootloader with internal clock (i.e. internal 8MHz clock without external crystal), how can I follow the instruction https://www.arduino.cc/en/Tutorial/ArduinoToBreadboard? How to connect the 32 pin MLF to the breadboard?

Thanks again

New entry in boards.txt (make a copy of the uno board def and change the name of the board), change frequency to 8000000L instead of 16000000L, and low fuse to E2. - that'll get you internal clock at 8mhz - then to make Optiboot work, change upload speed to 57600 (the 16mhz bootloader thinks it's running at 115200 - but it's at 8, not 16, so it's running slower). Note that with the internal oscillator, you may have problems uploading using the bootloader, because the internal oscillator is sometimes not accurate enough to do serial.

Then just connect the ISP to the appropriate pins on whatever board you have the MLF-32 ATmega 328p soldered to, and do burn bootloader. No need to breadboard anything when you've got a custom board with an MLF part on it - that's for easily wiring up stuff with DIP/through-hole packages.