Arduino ISP Plus Atmega328P
Connection of an Arduino ISP and an new Atmega328P
This is how you have to connect an Arduino running as ISP with a brand new, empty Atmega328P. After this, you can then burn the bootloader on it, turning it into an standalone Arduino chip.
To transform an ardiono board into an In-circuit System Programmer (ISP, or ICSP), you must plug the Arduino board to the PC and upload the sketch "ArduinoISP" on it, from the Examples menu.
Don't forget the 10uF between RST and GND in Arduino ISP, otherwise it will not work. It is needed to undergo the autoreset function!
It is fun also to take a look at memory content at the Atmega chip before and after the recording process.
You can copy the command like from Arduino IDE and change it according to your board. I'm using it for UNO board.
I have made everything in Windows but it is easy to reproduce in another OS.
In the command prompt, type this to erase everything:
C:\"Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4 -b19200 -e -Ulock:w:0x3F:m -Uefuse:w:0x05:m -Uhfuse:w:0xDE:m -Ulfuse:w:0xFF:m
Be careful, this will erase any content in flash and eeprom memory.
After this, enter in terminal mode:
C:\"Program Files (x86)"\Arduino\hardware\tools\avr\bin\avrdude -CC:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM4 -b19200 -t
And check the flash content at the end (where the bootloader will be later recorded):
dump flash 0x7e00 512
512 is the byte count, exactly the size of the bootloader.
In memory dump, 0xFF means that that address has nothing, is erased.
Now hit CTRL+C to exit terminal mode, get back to Arduino IDE and select the board (Uno), serial port, and the hit "Burn Bootloader" option from Tools drop down menu.
Wait some seconds until it finishes (if you have debug messages enabled you will see every avrdude message. In the end it says "avrdude done. Thank you.").
Enter terminal mode again with avrdude and type:
dump flash 0x7e00 512
And now you see that the bootloader has been realy recorded.