To burn bootloader to Arduino MEGA 2560 using Arduino Uno as ISP, connect Uno & MEGA as shown:
PC is connected to Uno.
- Program Uno as ArduinoISP
> Select board of Uno
> Select programmer of AVRISP mkII
> File > Examples > ArduinoISP > ArduinoISP
> Upload
- Now we are going to program MEGA, the Uno act as Arduino as ISP.
> Select board of MEGA
> Select programmer of Arduino as ISP
> Tools > Burn Bootloader
This post show how to program the ATmega328 on a standalone breadboard Arduino. Using Arduino Uno as Arduino ISP.
Connect your breadboard Arduino to Arduino Uno as shown here:
Extra components needed:
- a 16 MHz crystal
- two 22 picofarad capacitors, between the crystal and GND.
- a 10k resistor, between pin 1 of ATMEGA328P and +5V.
- LED and 1K resistor, used in our Blink example. LED cathode connect to GND, anode connect to the 1K resistor, connect to pin 19 of ATMEGA328P.
The basic steps:
- Connect the breadboard to Arduino Uno as shown above.
- Connect Uno to PC using USB.
- Start Arduino IDE, and program the Arduino Uno as ArduinoISP.
- Switch Tools -> Board to our target board.
- Select Tools -> Programmer -> Arduino as ISP.
- Burn Bootloader.
- Compile and upload your sketch.
I suppose the target board is very similar to Nano board, so I select Board of Arduino Nano, and Processor of ATmega328. It success to burn bootloader, but FAIL to upload sketch, with error of: avrdude: stk500_getsync() attempt x of 10: not in sync: resp=0x1c
As show in this video:
I have to modify boards.txt to add a new board, copy from nano. The file should be locate in the folder arduino-1.5.8/hardware/arduino/avr/. For safety, make a copy before edit.
Find the entry of nano, copy and rename another board, bba.name=BreadBoard Arduino in my case. Modify the content as:
Re-start Arduino IDE after boards.txt modified and saved.
This video show how to edit the file boards.txt:
Finally, we can program the ATmega328 on breadboard using Arduino Uno as ISP, and select our custom BreadBoard Arduino, of processor ATmega328 as target.
This post show how to use Arduino Uno as "Arduino as ISP", to burn bootloader on a empty ATmega328, marked ATMEGA328P-PU.
Extra components needed:
- a 16 MHz crystal,
- a 10k resistor, and
- two 22 picofarad capacitors.
Steps:
Program your Arduino Uno to be "Arduino as ISP":
- Connect Arduino Uno to PC with USB cable.
- Select Tools -> Port and your current connected Board (Arduino Uno).
- Select File -> Examples of ArduinoISP.
- Compile and upload to your Arduino Uno board.
- Once finished, your Arduino Uno is a "Arduino as ISP" now.
Burn bootloader to Atmega328, using your "Arduino as ISP":
- Select Tools -> Board, it is the board on which you want to burn the bootloader, not your current connect board. I will use Arduino Uno as target to verify my steps and setup later, so I keep using Arduino Uno.
- Select Tools -> Programmer of "Arduino as ISP".
- Select Tools -> Burn Bootloader
- Done.
Verify:
- Disconnect USB cable between Arduino Uno and yout PC.
- Replace the ATmega328 controller on your Arduino Uno with the new burnt ATmega328.
- Connect to PC again and try any example, it should be work as your original Arduino Uno.
Remark:
(I)
I have one chance failed with the error:
Arduino: 1.5.7 (Linux), Board: "Arduino Uno" avrdude: Yikes! Invalid device signature. Double check connections and try again, or use -F to override this check. This report would have more information with "Show verbose output during compilation" enabled in File > Preferences.
It is caused by bad contact, solved by slightly fixing the wires.