본문 바로가기

개발

아두이노 부트로더 복구하기

펌웨어가 나가면 Bootloader새로 구워야하는데, Arduino IDE에서 안되면, 아래처럼 Arduino avrdude로 커맨드로 하면 억지로 되긴한다.

초기 설정은 아두이노 홈피에서 Arduino as ISP 로 설정하는 법과 SPI로 연결한뒤에 하는 것.

인터넷에 있는 2단계 가이드대로 따라했던것이고 결과 로그까지 첨부한 것임.

국내에 보급되고 있는 아두이노중에, 아두이오 Uno베이스로 328P 를 쓴 것들에서, USB가 FTDI나 CH340쓴것으로 약간 사용성이나 문제가 갈리는 것 같고, 보드에 OSC의 클럭에 따라서 PC호환성이나 동작안정성, 고장률이 다른것으로 보임. 뭐 일차적으로는 핀에다 마구 꼽는것에 따라서 쇼트발생이 잦아서 보드가 나가는 경우도 많아 보이고, 전원 부족으로 잠시 안되는 경우도 있어보임.... 결론은 뽑기운이 많이 따라줘야함. 윈10에서 USB 드라이버 호환성문제도 있어보임.... 쩝.

C:\Program Files\Arduino\hardware\tools\avr\bin>avrdude -P COM5 -b 19200 -c avri
sp -p m328p -v -e -U efuse:w:0x05:m -U -hfuse:w:0xD6:m -U lfuse:w:0xFF:m -C ..\e
tc\avrdude.conf

avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "..\etc\avrdude.conf"

         Using Port                    : COM5
         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    20     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.05s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: erasing chip
avrdude: reading input file "0x05"
avrdude: writing efuse (1 bytes):

Writing |                                                    | 0% 0.00s ***faile
d;
Writing | ################################################## | 100% 0.08s

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.01s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xfd != 0x05
avrdude: verification error; content mismatch

avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: efuse changed! Was 5, and is now fd
Would you like this fuse to be changed back? [y/n] n
avrdude: safemode: Fuses OK (E:05, H:DA, L:FF)

avrdude done.  Thank you.


C:\Program Files\Arduino\hardware\tools\avr\bin>avrdude -P com5 -b 19200 -c avri
sp -p m328p -v -e -U flash:w:ATmegaBOOT_168_atmega328_pro_8MHz.hex -U lock:w:0x0
F:m -C ..\etc\avrdude.conf

avrdude: Version 6.3, compiled on Jun 22 2016 at 16:05:21
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "..\etc\avrdude.conf"

         Using Port                    : com5
         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    20     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.04s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: erasing chip
avrdude: reading input file "ATmegaBOOT_168_atmega328_pro_8MHz.hex"
avrdude: input file ATmegaBOOT_168_atmega328_pro_8MHz.hex auto detected as Intel
 Hex
avrdude: writing flash (32652 bytes):

Writing | ################################################## | 100% 0.05s

avrdude: 32652 bytes of flash written
avrdude: verifying flash memory against ATmegaBOOT_168_atmega328_pro_8MHz.hex:
avrdude: load data flash data from input file ATmegaBOOT_168_atmega328_pro_8MHz.
hex:
avrdude: input file ATmegaBOOT_168_atmega328_pro_8MHz.hex auto detected as Intel
 Hex
avrdude: input file ATmegaBOOT_168_atmega328_pro_8MHz.hex contains 32652 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.06s

avrdude: verifying ...
avrdude: 32652 bytes of flash verified
avrdude: reading input file "0x0F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.03s

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.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified

avrdude: safemode: hfuse reads as DA
avrdude: safemode: efuse reads as FD
avrdude: safemode: Fuses OK (E:FD, H:DA, L:FF)

avrdude done.  Thank you.


C:\Program Files\Arduino\hardware\tools\avr\bin>