By Leff
#5099
Dear friend, don't worry if your board loses its bootloader. Here is several steps to save your arduino card. The only thing you need is another good Arduino card, e.g. Uno, Mega, Leonardo etc. (I only tested on these three kinds of cards, Leonardo is a lot of different, please go below to track.)
 
Note This allows you to use the board to burn the bootloader onto an AVR (e.g. the ATmega168 or ATmega328 used in Arduino). :!: Arduino official tutorial, source page.

Here, we have two Arduino Boards, to distinguish them, we call
  • The one doing as an AVR ISP (In-System Programmer) - Board A
  • Another one which lost boot-loader was called Board B.


Step

NOTE: Arduino 1.0.6/ 1.6.8 all worked.

  1. Connect Board A to your commputer and choose corresponding "board" and its "Serial Port".

  2. Open the sketch ArduinoISP firmware (in Examples), and upload to board A.

    (89.94 KiB) Downloaded 2300 times


    Note for Arduino 1.0: you need to make one small change to the ArduinoISP code. Find the line in the heartbeat() function that says "delay(40);" and change it to "delay(20);". (Arudino 1.0.6 is already updated to delay(20).)

  3. Wire your board A to the target B as shown in the diagram below.

    (54.52 KiB) Downloaded 2300 times


    Note for the Arduino Uno: You'll need to add a 10 uF capacitor between reset and ground. (after uploading the ArduinoISP sketch) (this note is from Arduino®, but actually I tested on DF UNO, it is not necessary. ;) )

    Note for the Board B: if it's Romeo (Made by DFRobot, board: Leonardo), wire according to above picture, it will faied. You have to wire to ICSP pin, like following diagram: (or like the second post below, connect the ICSP pin directly)

    (30.95 KiB) Downloaded 12672 times


    (187.34 KiB) Downloaded 2300 times

  4. Choose right "board" of Board B

    NOTE: You can upload any code you wish to your ICs using this method.

  5. choose ''Programmer"-"Arduino as ISP"

    (101.65 KiB) Downloaded 2300 times

  6. Click Burn Bootloader, wait a second, it will be done.

    (101.02 KiB) Downloaded 2300 times


Epilogue

This is what I done on different boards (B) with DFRobot UNO as ISP programmer.


  • Mega2560

  • Bluno, board -> UNO

    Bluno, board -> UNO
    (108.41 KiB) Downloaded 2300 times

  • Romeo, board - Leonardo

    Romeo, board - Leonardo
    (122.49 KiB) Downloaded 2005 times

Further more, this is what I done on DFRobot Mega2560 as ISP programmer. (with Arduino 1.6.8)

#8885
Using Leonardo as the ISP programmer

Here, I will use Leonardo as an ISP Programmer to burn bootloader to another Arduino Card, Uno here I used. source reading.[/i]

Wiring
(171.89 KiB) Downloaded 12377 times

Wiring
  • 5 pins of ICSP interface (Leonardo) -> ICSP (Uno)
  • D10 (Leonardo) -> RESET (Uno)
  • USB cable -> Leonardo


STEPS

NOTE: Arduino IDE 1.0.6. it should be. (1.6.8 was tested failed)

  1. Open Arduino IDE 1.0.6, choose Leonardo and corresponding COM port

    (11.09 KiB) Downloaded 12377 times

  2. Open sketch, Arduino ISP

    (11.79 KiB) Downloaded 12377 times

  3. Modify SS pin num: #define RESET SS to 10, i.e.
    Code: Select all
    #include "pins_arduino.h"[/list]
    #define RESET     10
  4. Upload the sketch to Leonardo (as programmer)

  5. Download the leofix.zip below, unzip it to the Arduino folder_D:\Program Files (x86)\arduino-1.0.6\hardware
    (398 Bytes) Downloaded 259 times

    (34.83 KiB) Downloaded 12377 times

  6. Restart Arduino IDE, or you can't proceed on.

  7. Choose the board losing bootloader, here mine is UNO

    (5.88 KiB) Downloaded 12377 times

  8. Choose Arduino as ISP (Leonardo)

    (7.69 KiB) Downloaded 12377 times

  9. Click Burn Bootloader to go

    (8.88 KiB) Downloaded 12377 times

  10. After a while, it will be done.

    (1.09 KiB) Downloaded 12377 times
#8937
As How to Upload a hex file using Command Line instead of Arduino IDE, please go to Installing an Arduino Bootloader ---> Uploading Code - Hard Way, by Sparkfun.

This is a copy from there.

Uploading Code - Hard Way

The hard way is for those people who want to use the command line. This method may be more preferable if you are modifying and recompiling and don’t want to have to keep updating the IDE, but otherwise its pretty unnecessary. Again you will need to get the programmer, and hook everything up. In this example we are using avrdude on Windows.

There are two steps to this process. The first step involves setting the fusebits. Fusebits are the part of the AVR chip that determine things like whether you are using an external crystal or whether you want brown out detection. The commands listed below are for the Arduino Uno using an ATMega328, they will probably work on some other similar boards such as the Duemilanove, but make sure you know what you are doing before playing with fusebits (NOTE: these fusebits will not work on a 3.3V/8MHz board). All the required fuse bits are listed in the boards.txt file for different boards, but again, if you have a boards.txt file installed then just use the Easy Way.

  • Arduino as ISP:
    Code: Select all
    avrdude -P comport -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

  • AVR Pocket Programmer:
    Code: Select all
    avrdude -b 19200 -c usbtiny -p m328p -v -e -U efuse:w:0x05:m -U hfuse:w:0xD6:m -U lfuse:w:0xFF:m

The second step is actually uploading the program.

  • Arduino as ISP:
    Code: Select all
    avrdude -P comport -b 19200 -c avrisp -p m328p -v -e -U flash:w:hexfilename.hex -U lock:w:0x0F:m  
  • AVR Pocket Programmer:
    Code: Select all
    avrdude -b19200 -c usbtiny -p m328p -v -e -U flash:w:hexfilename.hex -U lock:w:0x0F:m
One last bit of info. As we stated earlier, a bootloader is essintially a .hex file. Thus, you can use this method to upload and code you wish to your ICs.
#9307
How to use an Arduino UNO to renew Vortex's bootloader (ATmega328p)

Actually, Vortex is an Arduino UNO + CC2540 (= Bluno), and expanded with many other modules. So as long as you find the ATmega328p's ICSP interface, follow the steps above, you could use a UNO to reflash ATMega328p.

Vortex's ATmega328p's ICSP interface
(679.16 KiB) Downloaded 12089 times


Here is what I did (no capacitor was used here, no need to change anything in the sample code "ArduinoISP" in Arduino IDE1.6.9, but as reported by a customer that in Arduino IDE1.0.6, the capacitor is a MUST, or will be failed to upload):

(943.2 KiB) Downloaded 1717 times
#12742
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 ?
#33024
hey there.
I've recently bought RoMeo BLE from one of the local resellers. and I'm unable to upload my scratch on it.
Found this post, but unable to see any photo from it (wiring schemes are necessary for now). Can anyone help with that?