ATMEGA2560 Standalone Using Arduino UNO
Intro: ATMEGA2560 Standalone Using Arduino UNO
In this instructable we will learn how to bootload the ATMEGA2560 chip and how to upload Arduino Mega sketches to it.
STEP 1: Getting Started...
I know that many of us (including me) want ATMEGA2560 in standalone mode for our projects, as it is far better than ATMEGA328. So, here is a simple & easiest way to get working ATMEGA2560 in standalone mode.
Let's get started...
Here is a pin diagram of ATMEGA2560 which will be useful further in this Instructable. The file is in PDF & svg format. Take a print of it.
STEP 2: Parts Needed.
Arduino UNO board.
Atmega2560 SMD IC.
QFP-100 breakout board.
Male header pins.
10k resistor.
16MHz crystal.
22pf capacitors X 2
A LED.
Wires for connection.
Arduino IDE. (I have 1.6.8)
STEP 3: Soldering ATMEGA2560 on to QFP-100 Board.
If you have a board with 2560 already soldered on, then it is fine, you may skip to the next step.
If you do not have a board with 2560 already soldered on (just like me), then watch the video How to solder SMD 100pin IC on to QFP-100 board. This will guide you on soldering steps.
Video credits to the respective owner.
STEP 4: Bootloading 2560. Part I
Assuming that our ATMEGA2560 is empty, we will program the Arduino bootloader.
Start the Arduino IDE program. Connect just the Arduino UNO and load the File -> Examples -> ArduinoISP sketch. Select the Arduino UNO board under Tools and the default AVRISP mkII as programmer. Select the serial port and finally compile and upload the sketch as you would normally do.
After uploading is done, Disconnect the Arduino and proceed to connections as below: (Refer the pin diagram of 2560 IC provided in step 1)
UNO pins -> ATMEGA2560 pins
10 -> 30
11 -> 21
12 -> 22
13 -> 20
5v -> VCC (in my case pin 10)
GND -> GND (in my case pin 11)
connect the 16MHz crystal & 22pf capacitors to ATMEGA2560 as shown in diagram.
Also connect a 10k resistor between VCC and pin 30 of Atmega2560.
STEP 5: Bootloading 2560. Part II
Once done with the connections, now find a file called "boards.txt" in your Arduino installation directory.
In my case, the path is "C:\Program Files (x86)\Arduino\hardware\arduino\avr".
Open it with a text editor (I used Notepad++) and locate to the ATMEGA2560 section. Find the line "mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD8"
We have to replace the value of "0xD8" with "0xD9". This is so, because in stand-alone ATMEGA2560 chips, if the BOOTRST fuse is not set, the chip will be correctly programmed, but the programs will never run. So the line could look like this (we can keep the original line commented as I did.)
"mega.menu.cpu.atmega2560.bootloader.high_fuses=0xD9".
Save the changes and close the text editor.
Now we burn the bootloader. Connect the Arduino UNO board & open Arduino IDE, go to tools, and select as following:
Board: Arduino Mega 2560.
Processor: ATMEGA2560.
Programmer: Arduino as ISP.
Port: (respective arduinoUNO port).
And now from tools, click "Burn Bootloader". If everything is done correctly, the process will take some seconds and will finish with no errors.
STEP 6: Programming Arduino Sketches to ATMEGA2560.
Now as we have done bootloading, we proceed with uploading a blink sketch to our 2560 chip.
Disconnect the Arduino from your computer.
Disconnect the previous connections we have made, except the connections of the crystal to 2560. Now connect as following:
UNO pins -> ATMEGA2560 pins
5v -> VCC
GND -> GND
reset -> 30
Rx -> 2
Tx -> 3
Now, REMOVE THE ATMEGA328 FROM UNO BOARD. Connect a LED accordingly
LED positive + to 22 of 2560 chip.
LED negative - to GND of 2560 chip.
Now connect arduino board, open Arduino IDE & open 'Blink' sketch from Files-> Examples-> Basics. In void setup & void loop, change output pin 13, to 50. (or copy the code attached) & upload the code with following settings in tools:
Board: Arduino Mega 2560.
Processor: ATMEGA2560.
Programmer: AVRISP mkll.
Port: (respective arduinoUNO port).
ARDUINO CODE:
void setup()
{
pinMode(50, OUTPUT);
}
void loop()
{
digitalWrite(50, HIGH);
delay(1000);
digitalWrite(50, LOW);
delay(1000);
}
The LED connected to 2560 chip should blink. Now you can upload your Arduino MEGA sketches & connect your own circuit keeping the crystal connection as it is & with above settings in tools. You may refer the pin diagram provided in step 1 or the datasheet of Atmega2560 for your circuits.
Best of luck...
STEP 7: Tips and Problems.
Some people, reported having problems when using the same 5V power source from the Arduino. If you get problems about the programmer or board not responding, recheck the connections or try using another power source for the chip ( battery, another Arduino, etc. ).
The sketch still doesn't run after following the instructions. Please enable the verbose mode (enable the checkboxes in the Preferences dialog for compiling and uploading) in Arduino, and check again the fuse settings applied correctly. You'll see them in avrdude command output. If it doesn't show the correct fuse value, you either incorrectly edited the boards.txt file or you edited the wrong file.
15 Comments
entropia 8 months ago
let ask some doubt I have. It's about change sketch upload from arduino uno to FT232RL. My goal is to upload code from computer to Atmega2560 standalone with that uart device. Could you give me some tip?
entropia 8 months ago
First of all congrats! Very good job!
I have a question, 10k resistor between vcc and reset while burning bootloader. I don't understand because there is a reset signat (pin 10 UNO) supporting the begining of this process at the same pin. Having to resets in parallel does not look logic.
Best
trieuvuquan 3 years ago
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
I have changed the boards.txt, add crystal and the cap to the boards, but no luck. could you take a look and guide me what to do? Thanks in advance!
Silicon14 3 years ago
Check your crystal & capacitors connection once again. Make sure the crystal and the capacitor are connected neatly and are tight. If you see in the very first image of this instructable (the one before the start of this instructable), you will see that I have put cap pin and crystal pin in only one hole of the red breedboard. (Zoom in to see)
Try to keep it as close as possible and make sure the connection between the 2560 and crystal circuit is good and is nor floating or loosely connected.
Hope this solves your problem
trieuvuquan 3 years ago
pooja_ravishankar 2 years ago
thanks in advance!
Pooja
KevinL204 5 years ago
hey. thanks for the instruction. it is very useful actually, but mine is not working. i keep following the step you are in, but i only get this:
"avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\KEVIN\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino9/etc/avrdude.conf"
Using Port : COM15
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATmega2560
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PA0
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 10 8 0 no 4096 8 0 9000 9000 0x00 0x00
flash 65 10 256 0 yes 262144 256 1024 4500 4500 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000 (retrying)
Error while burning bootloader.
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you."
can you help me solve this?
yogesYogi 4 years ago
Silicon14 4 years ago
This device signature issue is not new..
Can you tell me the exact number of your 2560 IC
like for me it is "ATMEGA2560 16U-TW"
The number after ATMEGA2560 if different, causes this issue..
I'm soo sorry for late reply
NischalM4 4 years ago
Silicon14 4 years ago
This device signature issue is not new..
Can you tell me the exact number of your 2560 IC
like for me it is "ATMEGA2560 16U-TW"
The number after ATMEGA2560 if different, causes this issue..
I'm soo sorry for late reply
rakeshonebrs 4 years ago
Silicon14 4 years ago
First of all sorry for late reply..
Assuming you have kept the crystal connections as it is while uploading your program & settings as I told.
I understand your problem, it seems that you did not edit or incorrectly edited "boards.txt" file.. because if you incorrectly edit the file, your program will get uploded but never run.
Follow the "Step 5: Bootloading 2560. Part II"
this may solve your problem :)
ArshdeepM 5 years ago
Hello, thank you for such a useful instructable. I have one concern before i can go ahead and make this project. If i try to compile my program using arduino uno, then it will give errors as it would not have the defined analog pins on it. Such as A11, A12 etc, which i am using in my project. How would that work in this case?
Silicon14 5 years ago
Hello,
Go to Tools and in Boards option select ''Arduino Mega or mega 2560'' and again in tools select processor as ''Atmega 2560''. Now compile your code for Arduino Mega, you will get no errors for your pins.