embeded/AVR (ATmega,ATtiny)2017. 11. 21. 13:37

커맨드 최종버전...

퓨즈 비트를 먼저 셋팅하고 리부팅 하고 나서, 플래시에 데이터를 쓴다~ 라는 설정 (들어있는 비트는 기본값 임)

일단 내가 가진 usbasp는 -B 옵션으로 SCK 변경이 안되서 좀 더 실험을 해봐야 함...

D:\avrdude>avrdude -v -cusbasp -pm64 -Ulfuse:w:0xC1:m -Uhfuse:w:0x99:m -Uefuse:w:0xFF:m -Ulock:w:0x3F:m -E reset && avrdude -v -cusbasp -pm64 -Uflash:w:atmega64.hex:i 



avrdude는 프로그램 종료시 기본으로 reset을 건다는데..

-E exitspec[,…]

By default, AVRDUDE leaves the parallel port in the same state at exit as it has been found at startup. This option modifies the state of the ‘/RESET’ and ‘Vcc’ lines the parallel port is left at, according to the exitspec arguments provided, as follows:


reset

The ‘/RESET’ signal will be left activated at program exit, that is it will be held low, in order to keep the MCU in reset state afterwards. Note in particular that the programming algorithm for the AT90S1200 device mandates that the ‘/RESET’ signal is active before powering up the MCU, so in case an external power supply is used for this MCU type, a previous invocation of AVRDUDE with this option specified is one of the possible ways to guarantee this condition.


noreset

The ‘/RESET’ line will be deactivated at program exit, thus allowing the MCU target program to run while the programming hardware remains connected.


vcc

This option will leave those parallel port pins active (i. e. high) that can be used to supply ‘Vcc’ power to the MCU.


novcc

This option will pull the ‘Vcc’ pins of the parallel port down at program exit.


d_high

This option will leave the 8 data pins on the parallel port active (i. e. high).


d_low

This option will leave the 8 data pins on the parallel port inactive (i. e. low).


Multiple exitspec arguments can be separated with commas. 

[링크 : http://www.nongnu.org/avrdude/user-manual/avrdude_4.html]

[링크 : http://www.avrfreaks.net/forum/avrdude-reset-command[]



atmega64에서 avrdude로 테스트

-p에서 칩을 정해주지 않으면 실행이 되지 않는다.

D:\avrdude>avrdude -patmega64 -cusbasp


avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: program enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

         Double check connections and try again, or use -F to override

         this check.



avrdude done.  Thank you.

D:\avrdude>avrdude -patmega64 -cusbasp


avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.02s


avrdude: Device signature = 0x1e9602 (probably m64)


avrdude: safemode: Fuses OK (E:FF, H:C9, L:FF)


avrdude done.  Thank you.



D:\avrdude>avrdude -patmega64 -v -cusbasp


avrdude: Version 6.3, compiled on Feb 17 2016 at 09:25:53

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch


         System wide configuration file is "D:\avrdude\avrdude.conf"


         Using Port                    : usb

         Using Programmer              : usbasp

         AVR Part                      : ATmega64

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PA0

         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  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom         4    20    64    0 no       2048    8      0  9000  9000 0xff 0xff

           flash         33     6   128    0 yes     65536  256    256  4500  4500 0xff 0xff

           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00


         Programmer Type : usbasp

         Description     : USBasp, http://www.fischl.de/usbasp/


avrdude: auto set sck period (because given equals null)

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: error: program enable: target doesn't answer. 1

avrdude: initialization failed, rc=-1

         Double check connections and try again, or use -F to override

         this check.



avrdude done.  Thank you.

D:\avrdude>avrdude -patmega64 -v -cusbasp


avrdude: Version 6.3, compiled on Feb 17 2016 at 09:25:53

         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         Copyright (c) 2007-2014 Joerg Wunsch


         System wide configuration file is "D:\avrdude\avrdude.conf"


         Using Port                    : usb

         Using Programmer              : usbasp

         AVR Part                      : ATmega64

         Chip Erase delay              : 9000 us

         PAGEL                         : PD7

         BS2                           : PA0

         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  MaxW   ReadBack

           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------

           eeprom         4    20    64    0 no       2048    8      0  9000  9000 0xff 0xff

           flash         33     6   128    0 yes     65536  256    256  4500  4500 0xff 0xff

           lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00

           calibration    0     0     0    0 no          4    0      0     0     0 0x00 0x00

           signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00


         Programmer Type : usbasp

         Description     : USBasp, http://www.fischl.de/usbasp/


avrdude: auto set sck period (because given equals null)

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.03s


avrdude: Device signature = 0x1e9602 (probably m64)

avrdude: safemode: hfuse reads as C9

avrdude: safemode: efuse reads as FF


avrdude: safemode: hfuse reads as C9

avrdude: safemode: efuse reads as FF

avrdude: safemode: Fuses OK (E:FF, H:C9, L:FF)


avrdude done.  Thank you.


-Ulock:r:-:i 로 lock 비트나 fuse 비트를 읽어서 콘솔로 출력가능 함

D:\avrdude>avrdude -patmega64 -cusbasp -Ulock:r:-:i


avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.03s


avrdude: Device signature = 0x1e9602 (probably m64)

avrdude: reading lock memory:


Reading | ################################################## | 100% 0.02s


avrdude: writing output file "<stdout>"

:010000003FC0

:00000001FF


avrdude: safemode: Fuses OK (E:FF, H:C9, L:FF)


avrdude done.  Thank you. 

[링크 : http://shawnhymel.com/622/quick-tip-reading-fuse-bits-in-an-arduino/]


일단.. -p 옵션의 칩이 다르면 중단한다.(avr studio랑 같네..)

D:\avrdude>avrdude -patmega128 -cusbasp -Ulock:r:-:i


avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% -0.00s


avrdude: Device signature = 0x1e9602 (probably m64)

avrdude: Expected signature for ATmega128 is 1E 97 02

         Double check chip, or use -F to override this check.


avrdude done.  Thank you. 


다 읽는데 35초 정도? 늦게 걸리길래 속도 업해보려고 하니 지원을 하지 않는다고 한다. ㅠㅠ

D:\avrdude>avrdude -patmega64 -cusbasp -Uflash:r:dump.hex:i -B 0.6


avrdude: set SCK frequency to 1500000 Hz

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.03s


avrdude: Device signature = 0x1e9602 (probably m64)

avrdude: reading flash memory:


Reading | ################################################## | 100% 35.25s


avrdude: writing output file "dump.hex"


avrdude: safemode: Fuses OK (E:FF, H:C9, L:FF)


avrdude done.  Thank you. 

D:\avrdude>avrdude -patmega64 -cusbasp -Uflash:r:dump.hex:i -B 2


avrdude: set SCK frequency to 375000 Hz

avrdude: warning: cannot set sck period. please check for usbasp firmware update.

avrdude: AVR device initialized and ready to accept instructions


Reading | ################################################## | 100% 0.05s


avrdude: Device signature = 0x1e9602 (probably m64)

avrdude: reading flash memory:


Reading | ################################################## | 100% 35.25s


avrdude: writing output file "dump.hex"


avrdude: safemode: Fuses OK (E:FF, H:C9, L:FF)


avrdude done.  Thank you.


일단 펌웨어 업데이트 시도는 해봐야 할 듯...

[링크 : http://tmlgt.blog.me/220332919733]

[링크 : http://blog.lincomatic.com/?p=1480]



+

초기값 셋팅이 atmega4에서 아래와 같이 나오는데

맞는진 확인해 봐야겠지만.. intel HEX 포맷을 기반으로 읽으려니 빡쳐서 hexa로 출력!

avrdude: safemode: Fuses OK (E:FD, H:99, L:E1

D:\avrdude>avrdude -patmega64 -cusbasp  -v -Ulock:r:-:i

avrdude: writing output file "<stdout>"

:010000003FC0

:00000001FF

D:\avrdude>avrdude -patmega64 -cusbasp  -v -Ulock:r:-:h

avrdude: writing output file "<stdout>"

0x3f


그걸 계산기에 때려 넣으니 아래와 같이 나온다.

internal RC 1MHz 이고 Lockbit는 0xFF인데

bit 7/6이 사용 불가인지 0x3F가 실질적인 기본 값인 것으로 보인다.


[링크 : http://eleccelerator.com/fusecalc/fusecalc.php?chip=atmega64]

[링크 : ]http://eleccelerator.com/...?chip=atmega64&LOW=E1&HIGH=99&EXTENDED=FD&LOCKBIT=3F]

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

avrisp mk2 / avrisp mk2 clone / stk500 clone  (0) 2017.11.21
avr unlock 관련  (0) 2017.11.21
avrdude 실행 안됨  (0) 2017.11.18
keil bootloader example - avr/atmel  (0) 2017.11.17
avrdude -U 옵션  (0) 2017.11.13
Posted by 구차니