Using an Arduino as an AVR ISP, burn bootloader
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)
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? kent1ukr
', 'https://www.dfrobot.com/wiki/index.php/DF-Beacon_EVB_SKU:_TEL0086', '', ' class="postlink"') kevindekemele
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):
Leff
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
Here, I will use Leonardo as an ISP Programmer to burn bootloader to another Arduino Card, Uno here I used. Leff
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.
- 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.
- 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) Leff