話說買了兩個Arduino Uno結果一不小心,把其中一個的 Bootloader搞壞了 :-( ,可是手邊又沒有ROM Writer,怎辦??? 上網找了一些資料,發現只要手上有一個"好的"Arduino 就可以把它當作ROM Writer以及Bootloader Source ,然後改寫修復壞的Arduino,參考網站如下:
https://learn.sparkfun.com/tutorials/installing-an-arduino-bootloader
我也把步驟寫出來給大家參考看看~
Reinstall Arduino bootloader
Step 1:
1)準備一個要寫入bootloader 的 Arduino Uno
2)準備一個可正常開機的 Arduino Uno ( Bootloader ok!! )
3)準備六條杜邦跳線(公 - 母)
2)準備一個可正常開機的 Arduino Uno ( Bootloader ok!! )
3)準備六條杜邦跳線(公 - 母)
Step 2:
依據下圖的指示接線
Step 3:
2) 下載 Arduino Optiboot Bootloader 並將之解開後,準備好BootLoader328REV3_firmata.hex 檔案
Step 4:
1) 將正常的Arduino 接上USB,開啟Arduino 程式
2) File --> Example --> ArduinoISP
Step5:
將程式上傳到正常的Arduino
Step6:
1)開啟Windows 命令提示字元(Dos Command 視窗)
2)輸入指令
C:\>avrdude -P com6 -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0x05:m -U hfuse
:w:0xD6:m -U lfuse:w:0xFF:m
Ps: com6 <==是指Arduino 的ComPort Number
執行過程如下:
C:\>avrdude -P com6 -b 19200 -c avrisp -p m328p -v -e -U efuse:w:0x05:m -U hfuse
:w:0xD6:m -U lfuse:w:0xFF:m
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : com6
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 5 4 0 no 1024 4 0 3600 36
00 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 45
00 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.18s
avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5
avrdude: erasing chip
avrdude: reading input file "0x05"
avrdude: writing efuse (1 bytes):
Writing | ################################################## | 100% 0.03s
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0x05:
avrdude: load data efuse data from input file 0x05:
avrdude: input file 0x05 contains 1 bytes
avrdude: reading on-chip efuse data:
Reading | ################################################## | 100% 0.05s
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xD6"
avrdude: writing hfuse (1 bytes):
Writing | ################################################## | 100% 0.07s
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xD6:
avrdude: load data hfuse data from input file 0xD6:
avrdude: input file 0xD6 contains 1 bytes
avrdude: reading on-chip hfuse data:
Reading | ################################################## | 100% 0.06s
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.03s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.04s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK
avrdude done. Thank you.
3)將bootloader的image寫入
C:\>avrdude -P com6 -b 19200 -c avrisp -p m328p -v -e -U flash:w:BootLoader328REV3_firmata.hex -U lock:w
:0x0F:m
執行過程如下:
C:\>avrdude -P com6 -b 19200 -c avrisp -p m328p -v -e -U flash:w:BootLoader328REV3_firmata.hex -U lock:w
:0x0F:m
avrdude: Version 5.10, compiled on Jan 19 2010 at 10:45:23
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch
System wide configuration file is "C:\WinAVR-20100110\bin\avrdude.conf"
Using Port : com6
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :
Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 5 4 0 no 1024 4 0 3600 36
00 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 45
00 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00
Programmer Type : STK500
Description : Atmel AVR ISP
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.19s
avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as 5
avrdude: erasing chip
avrdude: reading input file "1.hex"
avrdude: input file 1.hex auto detected as Intel Hex
avrdude: writing flash (32750 bytes):
Writing | ################################################## | 100% 14.34s
avrdude: 32750 bytes of flash written
avrdude: verifying flash memory against 1.hex:
avrdude: load data flash data from input file 1.hex:
avrdude: input file 1.hex auto detected as Intel Hex
avrdude: input file 1.hex contains 32750 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 29.78s
avrdude: verifying ...
avrdude: 32750 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):
Writing | ################################################## | 100% 0.06s
avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x0F:
avrdude: load data lock data from input file 0x0F:
avrdude: input file 0x0F contains 1 bytes
avrdude: reading on-chip lock data:
Reading | ################################################## | 100% 0.05s
avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D6
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OK
avrdude done. Thank you.
沒有留言:
張貼留言