How to restore or update Arduino Mega 2560 firmware?

This tutorial is for Linux users. It will cover step by step how to flash an Arduino with miscellaneous firmwares (it’s for absolute beginners, you should know Linux quite good to perform this). I use cheap cloned board called Mega Keyes model Mega 2560 R3 with Atmega 2560 16AU. You can also use this method to unbrick your faulty Arduino.

If your using Debian or any of it’s derivatives install the  dfu-programmer:

sudo apt-get update && sudo apt-get install dfu-programmer

Download latest firmware:


Or find any other one needed here.

Now connect your device to PC and enter DFU mode. To do that join two pins near USB connector:

Arduino Mega Keyes DFU Pins
Arduino Mega Keyes DFU Pins

It should turn on orange led or simply blink when it’s done.

Now input this commands:

 sudo dfu-programmer atmega16u2 erase

To erase previous firmware.

sudo dfu-programmer atmega16u2 flash --debug 1 Arduino-usbserial-mega.hex

To flash new one. It should output:

4070 bytes used (33.12%)

And last command:

sudo dfu-programmer atmega16u2 reset

Reset your Arduino.

And this is it 🙂


  • If you get: dfu-programmer: no device present using any of dfu-programmer commands you’re not in the DFU mode. Reset your device and short circuit DFU pins mentioned above.

What’s next?

You can turn your Arduino into keyboard or joystick board. Check this amazing project. I’ll cover that in next Arduino episode.

Stay tuned!




0 responses to “How to restore or update Arduino Mega 2560 firmware?”

  1. […] first check my previous note how to flash Arduino because you will need this knowledge to put new software on your […]

  2. Kang Kamal Avatar

    i’m using ch340 chip,. how to do with this my arduino?