Introduction: How to Use Arduino Mega 2560 As Arduino Isp
When i build my Atmega328p-pu on a circuit board for my moped i needed to bootload it.
Because i have none external programming equipment i needed to use my Arduino Mega 2560 as ArduinoISP ( http://arduino.cc/en/Tutorial/ArduinoISP ) .
You need:
-Arduino mega
-Breadboard or pcb made atmega chip arduino
-100nF capacitor
-usb cable for arduino mega 2560 -> pc
-arduino IDE ( http://arduino.cc )
-some wires to connect the arduino mega 250 to your homemade arduino.
One of the difficulties of the mega board is that all the pins are different so most tutorials who are aimed at the UNO board or the Duemilanove or Diecimila are useless because the Mega board pinout is different.
To know which pinout is needed for the Arduino Mega 2560 the arduino.cc website has a special webpage : ( http://arduino.cc/en/Main/ArduinoBoardMega2560 ) .
This is how you need to wire up your arduino mega 2560 to an Atmega 168/328 (same pinout) microchip : See picture above
PS. For the exact pinout of an Atmega 168/328 chip look : http://softsolder.files.wordpress.com/2009/09/arduino-vs-atmega168-chip-pinouts.png?w=640&h=302
The High resolution picture of how to hook the arduino up : http://i54.tinypic.com/k55pb9.png
Step 1: Uploading the ArduinoISP Sketch
Now open the latest version of the Arduino IDE (currently 0022) .
Goto Tools
-> Board
-> Arduino Mega 2560
Now choose the correct Com port via Tools -> Serial port -> select the port used by you're arduino mega 2560.
Goto File
-> Examples
-> ArduinoISP
The ArduinoISP sketch will open up and now click upload to upload the sketch to the Arduino Mega 2560.
When the sketch is fully uploaded Put a 100nF Capacitor Between +5V and RESET pin on the Arduino Mega 2560 to disable auto reset. (whitout this tutorial wont work !)
Step 2: Time to Burn the Bootloader
Picture 1: First: select the board you want to upload to.
Ex. for my Atmega328 chip and an external 16MHz crystal i chose: Arduino Duemilanove or Nano /w Armega 328 ( see pic 1 )
Picture 2: Goto Tools -> Burn Bootloader -> w/ Arduino as ISP
The board will begin bootloading.
Picture 3: When bootloading is successful you can enjoy your new homemade Arduino.
If you get errors :
1. Make sure you selected the correct board ( Picture 1 )
2. When getting this error: avrdude: stk500_getsync(): not in sync: resp=0x00
You did not put an 100nF capacitor between +5v and RESET pin on the Arduino Mega 2560
3. IF you still get another error search on google
4. If you still find no solution goto arduino forum : http://arduino.cc/forum/index.php/board,67.0.html
and post your problem + a link to this instructables.
Step 3: Finally Uploading the Programs to Your New Arduino
When your arduino is not set up whit auto-reset (DTR) you will have difficulties uploading new programs to the arduino.
And you will get this error: " avrdude: stk500_getsync(): not in sync: resp=0x00
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51 "
This means the arduino IDE could not reset the arduino and so the upload has failed.
To fix this you can try (depends on hardware etc...) :
1. Press reset button on your arduino when "Binary sketch size: xxxx bytes (of a xxxxxxx byte maximum)" appears.
2. If that does not work you can try to put the usb cable in the computer but not in the arduino. When the "binary sketch" stuff appears you quickly put the usb cable in the arduino and see if it uploads without and error.
3. If that still doesn't work you can try to hold the reset button on the arduino , press upload in the arduino IDE and release the reset button when the "binary sketch size ... " stuff appears.
4. If that still doesn't work you can try to press reset after the " binary sketch size ... " and hod it for 2-10 seconds ( it depends on hardware how long you need to hold it)
5. If that still doesn't work you can try to bootload it again and see if it was an error in the primary bootloading.
6.If that still doesn't work you can try to use ur other arduino ( if you have another) to program the second arduino
This link for more info: http://www.arduino.cc/en/Hacking/Programmer .
7. If that still doesn't work you can ask for help on the arduino.cc forum , maybe ur arduino microchip is dead ?
or a fake . http://arduino.cc/forum/
i hope i could help you!
Greetz spike

Participated in the
USB Contest
33 Comments
3 years ago
after i change my atmega328p before make this steps my arduino rx was flash 3 time and didnt complete uploading
but now is working 100%
many thanks
3 years ago
Hi every body
if you need to communicate with a kit possessor for any purposes what ever its try this
[https://www.com-port-monitoring.com/]
its perfect and strong I find it the best , this software had just solve a big problem of me, i had inter a industrial chines high protected kit and had a copy of the flash and the system possessor prog to solve anther machine problem without any interface or have the programming software tool that because chines not allow that tool for public even for the client or for sail.
by the way the soft I use was free and limited and lite and unregistered!!!! good luck , have fun
Tip 4 years ago
This WILL NOT work with the new ISP sketch unless you change the reset pin in the ArduinoISP sketch from 10 to 53. It's on line 73 of the ArduinoISP sketch.
#define RESET 10 -----------> change to -----> #define RESET 53
5 years ago
Note that with Arduino IDE 1.6.6 and newer the ArduinoISP sketch is found at File > Examples > 11.ArduinoISP and you need to connect pin 10 of the programmer board (Mega in this case) to the reset pin of the target microcontroller, not pin 53 of the Mega as it used to be with earlier versions of the ArduinoISP sketch.
5 years ago
Hi,
I had an issue with my arduino mega 2560 that is the watchdog timer code was not working. After burning the bootloader issue resolved.
But my question is what are the changes that has happened to Mega2560. If any new issue arises can I revert it back to old bootloader ?
5 years ago
hi my arduino show this message if you can help me plz
avrdude: stk500_recv(): programmer is not responding
6 years ago
Hi!
I'm on an ElCapitan MAC as well.
I added a 10uF capacitor between VCC (+5V) and RESET (PWM10) on the
MEGA2560 in order to udpate a USBaspv2 firmware and this is what I get:
----------------------
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e9307 (probably m8)
avrdude: safemode: hfuse reads as D9
avrdude: reading input file "/Users/alex/Desktop/USBasp2.hex"
avrdude: writing flash (4700 bytes):
Writing | ################################################## | 100% 6.67s
avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against /Users/alex/Desktop/USBasp2.hex:
avrdude: load data flash data from input file /Users/alex/Desktop/USBasp2.hex:
avrdude: input file /Users/alex/Desktop/USBasp2.hex contains 4700 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 3.33s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0002
0xcc != 0xa6
avrdude: verification error; content mismatch
avrdude: safemode: hfuse reads as D9
avrdude: safemode: Fuses OK (E:FF, H:D9, L:9F)
avrdude done. Thank you.
----------------------
Any clues what am I doing wrong?
Thanks!
7 years ago
I'm having trouble using the serial monitor to communicate with the atmega328p chip? Im using the arduino mega2560 as an isp to program an atmega328p on a breadboard, ive been successful in loading the bootloader and test sketches like blink to the chip, but now im trying to test a simple sketch that allows me to input a char into the serial monitor and should return a statement based on whether it reads the right char. So i uplaod the code just to the arduino mega2560 and it works fine, but when i turn it into an isp and upload it to the atmega328p on the breadboard i can no longer communicate through the serial monitor.
8 years ago on Introduction
thanks for the great tutorial! it worked with the blink sketch with an atmega328 on a breadboard... but after uploading, it seemed even my mega got the blink sketch, as the onboard led started blinking. is this suppoesd to happen? or did i do something wrong?
Reply 8 years ago on Introduction
I'm thinking that may be a pre-loaded sketch also written to the device with the bootloader, as mine came up with a 2x 1/2-second blinks, 1 second wait, loop indicator after re-burning my 2560 yesterday. (and seeing a XDRduino (mega2560 R3 Clone) running the same sketch out of the box, err.. Static Bag.)
8 years ago on Introduction
I'm wondering if the reverse can be done? I.E. reburning the bootloader for a 2560 using an UNO? My 2560 is acting up when I try connecting it to a Linux platform, requiring multiple unplug./reconnect's from the USB cable.. (when attempting to send a sketch to 2560, it remarks that it cannot locate the device, even though I know it's connected.) Also, it requests a weird USB port, other than /dev/ttyUSB0.) the Uno is a R2, (no SDA/SCL pins to the left of Ref).. latest IDE is V1.0.6 (yes, it will load under Linux/Ubuntu-Debian, despite the latest canonical being 1.0 on Ubuntu Software.)
Reply 8 years ago on Introduction
Update, I seem to have figured it out, partially, and with a small question..
I found a few more tutorials on how to hook up the Duemilinova or the UNO as an SPI master device (ArduinoISP in the examples).. After a 1st attempt, accidentally swapping MOSI/MISO, got the error LED lit, 2nd attempt, I managed to get the bootloader to burn, ran perfect for 160 seconds (19200 baud, Crikey! Forgot how slow that was! and couldn't change it to anything faster because the ArduinoISP loader will not sync correctly.) no error LED, the mega2560 showing a 2 blink, 1 second wait loop, but the IDE saying an incorrect response, (response on another computer) .. But, two examples compiled, uploaded, and ran from the 2560.. So, I'm hoping I've fixed the problem.
8 years ago on Introduction
thanks for the great tutorial! it worked with the blink sketch with an atmega328 on a breadboard... but after uploading, it seemed even my mega got the blink sketch, as the onboard led started blinking. is this suppoesd to happen? or did i do something wrong?
8 years ago on Step 2
thanks a million for this! works a charm :)
10 years ago on Step 3
By the way, the bootloader also seems to be hardcoded to 16MHz - and this now allows me to upload my scripts via the serial interface as well.
I just tell it to upload, hit the reset, and away it goes. This never worked at the 14.7456MHz frequency either and gave the errors mentioned in my other post.
10 years ago on Step 3
I have run into the avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51 (or resp=0x68 or resp=0x?? where ?? can be any number of different numbers) and the one thing that nobody seems to mention, which I finally figured out on my own is that serial is VERY timing dependant - and as such, if your serial library derives it's timing from the processor's clock, then your clock must be running at the same frequency.
I had a project where the serial communications simply wouldn't work after I moved the project off the Arduino board.
The problem? When I moved the project, I used a 14.7456MHz oscillator. I used that frequency because it usually makes writing serial timing easier since the baud rates are even divisions of this frequency. Unfortunately since I was using a standard library when developing it on the Arduino, it was all made for a 16MHz clock.
Once I changed the standalone circuit crystal to 16MHz, suddenly everything worked!
I hope this helps someone in the future !!! I know I was stumped for quite a while with this!
10 years ago on Introduction
This project is great
Thanks for the tutorial
10 years ago on Step 2
I had some problems with burning the bootloader.
I used Arduino MEGA 2560 and tried to burn bootloader in Arduino Duemilanove 326P.
Everything was connected according to the tutorial, but It resulted in error messages "out of sync".
I solved it by changing the heartbeat from 40 to 20.
10 years ago on Introduction
Thanks for the tutorial. Most of the documentation out there assumes you are using an Uno or a Due. I made a video to illustrate the differences for the Mega type boards.
Check it out here:
https://www.youtube.com/watch?v=DebJ1s5I3QM
10 years ago on Introduction
If you keep having problems and want to fix them just buy an programmer from Atmel , they are only like 30 USD and are really easy to use whit AVR studio and you can burn the Arduino firmware whit it.