Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Burn Arduino Bootloader into an fresh ATmega2560

Arduino, easy to use, easy to learn and whats the best part? Its open source.
Anyone can modify it in whatever way they want. So why not make one for our own?
As a first step, we ordered ATmega2560 16AU from ATMEL as sample ICs. It is
surface mounted on a breakout board from NEX-Robotics.

Then it comes the real game, burning the bootloader and making it ready to be
programmed by Arduino IDE.

This post [http://www.gammon.com.au/forum/?id=11635] from Nick Gammon explains it in detail.

1. Things we need:
• Programming Arduino, either a Uno or Mega, I have tested with both of
them, I hope every other Arduino will work.
• 16 MHz crystal
• Two capacitors of 18-22 pF
• Jumpers
• ATmega2560 to be bootloaded.
2. We need to get the bootloader sketch from Nick Gammon. You can get it form
his site or here [http://goo.gl/t7oogN] .
3. Place it in your Arduino IDE's sketch folder, "sketchbook". 
4. Load the sketch in Arduino IDE, connect your programming arduino and upload
the code, and remove the arduino.
5. Now we need to connect the ATmega to be programmed to the programming
arduino.
[http://1.bp.blogspot.com/-
d_OkcysZNSU/UkxOd7QFsQI/AAAAAAAAElY/yX1rVFIIuzQ/s1600/PinMap2560.png]
For that, we need to connect the ICSP header of the Arduino to the ATmega.

[http://1.bp.blogspot.com/-
DWM7OmUK_dI/UkxOdp2pCII/AAAAAAAAElQ/GUurYMtEyaI/s1600/icsp.jpg]
The ICSP header provides direct connection to the SPI interface of the chip.
We need to connect these of two chips directly. For an ATmega2560, its like
this:

ICSP pin name ICSP pin number ATmega2560 pin number


MISO 1 22
Vcc 2 10,31,61,80 any one of these
ICSP pin name ICSP pin number ATmega2560 pin number
SCK 3 20
MOSI 4 21
Reset 5, Do not connect this 30
11,32,62,81 any one of
GND 6
these
We will connect the Reset pin from the ATmega2560 to the D10 of programming
Arduino. This will provide the required reset pulses.
6. Now, we need to connect an oscillator to the ATmega2560 for the clock

signal. [http://2.bp.blogspot.com/-ek-
WDA6W8ww/UkxdcTKGg2I/AAAAAAAAElo/eVNOc1iZO6s/s1600/Crystal_resonator_schematic.jpg]
The 16MHz crystal should be connected to XTAL1 (pin 34) and XTAL2 (pin 33)
of ATmega2560, as shown in the figure.
7. The circuit part is over. Now we need to connect the Arduino to USB port and
start the Serial Monitor. It will show something like this, if everything is
fine:

Atmega chip programmer.Written by Nick Gammon.


Entered programming mode OK.
Signature = 0x1E 0x97 0x05
Processor = ATmega256016AU
Flash memory size = 262144 bytes.
LFuse = 0xFF
HFuse = 0xDE
EFuse = 0xFD
Lock byte = 0xEF
Bootloader address = 0x1FC00
Bootloader length = 1024 bytes.
MD5 sum of current bootloader = 77 2F 81 F1 7F 1E 46 93 97 B4 54 23 4C 44 72 68
Type 'V' to verify, or 'G' to program the chip with the bootloader ...

8. Press G and hit enter.

It will show the success message.

Thats it:)

Thanks to my partner Rahul Gulve for making this happen.

Posted 2nd October 2013 by Shahidh


Location: Center For Innovation,IIT Madras, IIT Madras, Indian Institute Of Technology, Chennai, Tamil Nadu
600036, India
Labels: Arduino, ATmega2560, bootloader, programming

14 View comments

bala October 18, 2013 at 8:54 PM


Nice Post!
Reply

Muddle headed August 15, 2014 at 9:30 AM


what arrangement did you use for programming 2560 and communicating with arduino IDE?
Reply

Nirvaan Singh November 4, 2014 at 8:16 AM


Did you figure it out? please help
Reply

Marcos Joel Scherer May 30, 2015 at 4:36 PM


I have a compiling error

c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:1153:8: error: 'size_t' does


not name a type
extern size_t __strlen_P(const char *) __ATTR_CONST__; /* program memory can't change */
^
c:\program files (x86)\arduino\hardware\tools\avr\avr\include\avr\pgmspace.h:1154:8: error: 'size_t' does
not name a type
extern size_t strnlen_P(const char *, size_t) __ATTR_CONST__; /* program memory can't change */
it continues.
Reply

Somnath Singh October 18, 2015 at 5:32 AM


Hey to program any mcu .. just connect below pins
RX TO RX
TX TO TX
RESET TO RESET
GND TO GND
VCC TO 5V

FROM ARDUINO TO TARGET MCU.

-+---------------------
BE innovative
HTTPS:/www.Innovationstracking.com
Reply

Replies

sankalp chapalgaonkar October 28, 2016 at 7:16 AM


After connecting these pins and removing the atmega 328 chip from arduino, I tried uploading
a simple code but its not getting uploaded. showing some error like:
{stk500v2_ReceiveMessage(): timeout}.

Reply

R.A.PATEL. April 14, 2016 at 5:27 AM


Hello Guys,

First of all I m very thankful of this Writer, the blog helps me a lot complete my brother's project on 2560,
as I m native Mechanical Engineer.
Thank you very much....
I finally succeed in uploading bootloader in 2560 using UNO,
but whenever I tried to upload any sketch, it gave errors.

I got solution of it.


Whoever face this problem, try the IDE option
Sketch --> Upload Using Programmer (Ctrl+Shift+U)

So, The sketch will be written in 2560 perfectly.

And yeah,, thank you Author once again.

Regards
Rinkesh Patel.
www.rinkeshpatel.com
Reply

Replies
Elec K June 30, 2016 at 3:22 AM
Hi patel

can you please say which programmer did you use to upload the code.

thanks in advance

Reply

Trent Smith April 23, 2016 at 1:46 PM


hello I wondering can I have permission to use the picture of the atmega2560 to use for a project in
school??
Reply

Replies

Shahidh April 27, 2016 at 9:50 PM


Please feel free to use the pictures. But, kindly link to the blog if possible

Reply

Elec K June 30, 2016 at 3:21 AM


This comment has been removed by the author.
Reply

chú Cóc xấu Xí October 22, 2016 at 6:49 AM


I'm trying upload sketch Atmega_Board_Programmer but i see a error: "variable 'atmega168_optiboot'
must be const in order to be put into read-only section by means of '__attribute__((progmem))'". I don't
know how to do. Can you help me?
Reply

Replies

chú Cóc xấu Xí October 22, 2016 at 6:50 AM


I'm uploading to Arduino UNO

CyberTron March 9, 2018 at 8:46 AM


add "const" before every variable and save it. Then try to upload.make sure every
variable(which giving error message) have "const".

Reply
Enter your comment...

Comment as: mdjortiz19@gmail.com


 (Google) Sign out

Publish Preview Notify me

You might also like