ArduinoGeneral

Using an Arduino as an AVR ISP, burn bootloader

userHead Leff 2015-08-11 17:33:46 29577 Views9 Replies

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.)
  
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 AAnother one which lost boot-loader was called Board B.



Step

NOTE: Arduino 1.0.6/ 1.6.8 all worked.

 

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

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


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

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


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)

 Choose right "board" of Board B

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

 choose ''Programmer"-"Arduino as ISP"

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

 



Epilogue

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

 

Mega2560

 Bluno, board -> UNO

 Romeo, board - Leonardo
 


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

 

 

2019-10-16 23:35:44 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?
userHeadPic kent1ukr
2016-10-20 02:26:26 I'm actually talking about this one:make_clickable_callback(MAGIC_URL_FULL, '
', 'https://www.dfrobot.com/wiki/index.php/DF-Beacon_EVB_SKU:_TEL0086', '', ' class="postlink"')
userHeadPic kevindekemele
2016-10-19 18:36:50 May I know the sku? TEL0095, right? userHeadPic Wendy.Hu
2016-10-13 15:06:11 Does anybody know how to do this for the DF beacon? The pin names are different. userHeadPic kevindekemele
2016-06-16 16:26:44 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.



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):

userHeadPic Leff
2016-05-06 16:15:27 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.
userHeadPic Leff
2016-04-26 17:45:17 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.
userHeadPic Leff
2015-08-11 17:33:46 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.

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.



    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.



    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)


  4. Choose right "board" of Board B

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

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


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



Epilogue

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


  • Mega2560

  • Bluno, board -> UNO

  • Romeo, board - Leonardo


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