Trybotics Logo

ATMEGA2560 Standalone Using Arduino UNO

DESCRIPTION

In this instructable we will learn how to bootload the ATMEGA2560 chip and how to upload Arduino Mega sketches to it.

Description:

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.

Attachments

Description:

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)

Description:

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.

Description:

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.

Description:

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.

Description:

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...

Description:

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.


YOU MIGHT ALSO LIKE