hfuse |
||||||||
Szesnastkowo (0x) | C |
9 |
||||||
Zapis w stylu PonyProg'a |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Wartość bitu |
1 | 1 | 0 | 0 | 1 | 0 | 0 | 1 |
Opis bitu |
RSTDISBL | WDTON | SPIEN | CKOPT | EESAVE | BOOTSZ1 | BOOTSZ0 | BOOTRST |
lfuse | ||||||||
Szesnastkowo (0x) | E |
F |
||||||
Zapis w stylu PonyProg'a |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Wartość bitu |
1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 |
Opis bitu | BODLEVEL | BODEN | SUT1 | SUT0 | CKSEL3 | CKSEL2 | CKSEL1 | CKSEL0 |
lfuse | ||||||||
Szesnastkowo (0x) |
A |
6 |
||||||
Zapis w stylu PonyProg'a |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Wartość bitu |
1 | 1 | 1 | 0 | 0 | 1 | 1 | 0 |
Opis bitu | CKDIV8 | BODEN | SUT1 | SUT0 | CKSEL3 | CKSEL2 | CKSEL1 | CKSEL0 |
voytek@tay:~$ avrdude -p attiny2313 -c usbasp -U lfuse:r:-:h -U lfuse:r:-:b -U hfuse:r:-:h -U hfuse:r:-:b
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e910a
avrdude: reading lfuse memory:
Reading | ################################################## | 100% 0.01s
avrdude: writing output file "<stdout>"
0x64
lfuse szesnastkowo
avrdude: reading lfuse memory:
Reading | ################################################## | 100% 0.01s
avrdude: writing output file "<stdout>"
0b1100100 lfuse dwójkowo
avrdude: reading hfuse memory:
Reading | ################################################## | 100% 0.01s
avrdude: writing output file "<stdout>"
0xdf
hfuse szesnastkowo
avrdude: reading hfuse memory:
Reading | ################################################## | 100% 0.01s
avrdude: writing output file "<stdout>"
0b11011111
hfuse dwójkowo
avrdude: safemode: Fuses OK
avrdude done. Thank you.
avrdude -p attiny2313 -c usbasp -U lfuse:r:-:h -U lfuse:r:-:b -U hfuse:r:-:h -U hfuse:r:-:b
avrdude
- wywołanie programu-p attiny2313
- rodzaj mikrokontrolera. Można również podać -p t2313
-c usbasp
- rodzaj programatora -U lfuse:r:-:h
-U
operacja na dalej podanej części pamięci, lfuse
"Fuse Low Byte" część pamięci której dotyczy operacja,:
separator,r
operacja czytaj (read) wcześniej podaną część pamięci, :
następny separator, -
wyślij wynik na standardowe wyjście (stdout) czyli ekran :
następny separator, h
-zapis szesnastkowy (hexadecimal) -U lfuse:r:-:b
- tak samo jak wyżej z wyjątkiem ostatniej litery. Zamiast h
jest b
(binary) dlatego wartość bajtu jest podana w zapisie dwójkowym.avrdude -p attiny2313 -c usbasp -U lfuse:r:-:b -U lfuse:r:-:o -U lfuse:r:-:d -U lfuse:r:-:h
usbasp
wpisujemy odpowiednio stk200
lub bsd
zależnie od podłączonego programatora.avrdude
-p attiny2313 -c stk200 -P /dev/parport0 -U
lfuse:r:-:b -U lfuse:r:-:h -U hfuse:r:-:b -U hfuse:r:-:h
avrdude
-p attiny2313 -c bsd -P /dev/parport0 -U lfuse:r:-:b
-U lfuse:r:-:h -U hfuse:r:-:b -U hfuse:r:-:h
-P
z wartością /dev/parport0
. Jednak polecenie powinno działać i bez tego ponieważ w AVRDUDE domyślnym portem jest pierwszy port równoległy czyli właśnie /dev/parport0
.avrdude -p attiny2313 -c stk200 -P lpt1 -U lfuse:r:-:b -U lfuse:r:-:h -U hfuse:r:-:b -U hfuse:r:-:h
avrdude -p attiny2313 -c bsd -P lpt1 -U lfuse:r:-:b -U lfuse:r:-:h -U hfuse:r:-:b -U hfuse:r:-:h
Jedyną różnicą w stosunku do polecenia pod Linuksem jest nazwa portu lpt1
zamiast /dev/parport0
.avrdude -p KONTROLER -c PROGRAMATOR -P PORT-U lfuse:r:-:b -U hfuse:r:-:b -U efuse:r:-:b
W miejsce KONTROLER
wpisujemy symbol mikrokontrolera. Aby zobaczyć listę symboli obsługiwanych kontrolerów napisz w terminalu polecenie:avrdude -p ?
PROGRAMATOR
wpisz
symbol programatora którym dysponujesz. Aby zobaczyć listę symboli
obsługiwanych programatorów napisz w terminalu polecenie:avrdude -c ?
PORT
wpisujemy nazwę
portu do którego jest podłączony programator. Domyślnie jest to
pierwszy port równoległy i wtedy nie ma potrzeby wpisywania go.
voytek@tay:~$ avrdude -p attiny2313 -c usbasp -U lfuse:w:0xA6:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e910a
avrdude: reading input file "0xA6"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xA6:
avrdude: load data lfuse data from input file 0xA6:
avrdude: input file 0xA6 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.01s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Ponieważ potem chcę pokazać działanie polecenia dla STK200 więc przywrócę fabryczne ustawienia. voytek@tay:~$ avrdude -p attiny2313 -c usbasp -U lfuse:w:0x64:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e910a
avrdude: reading input file "0x64"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.03s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0x64:
avrdude: load data lfuse data from input file 0x64:
avrdude: input file 0x64 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.01s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Jak widać posługiwanie się AVRDUDE w trybie tekstowym jest bardzo proste.
voytek@tay:~$ avrdude -p attiny2313 -c stk200 -P /dev/parport0 -U lfuse:w:0xA6:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.06s
avrdude: Device signature = 0x1e910a
avrdude: reading input file "0xA6"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xA6:
avrdude: load data lfuse data from input file 0xA6:
avrdude: input file 0xA6 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Podobnie jak przy czytaniu fusebitów, różnica między poleceniem
dla USBASP i STK200 sprowadza się do zmiany nazwy programatora i
podania nazwy portu do którego jest on podłączony.voytek@tay:~$ avrdude -p attiny2313 -c stk200 -P /dev/parport0 -U lfuse:w:0x64:m
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.
avrdude done. Thank you.
Nie udało się. voytek@tay:~$ avrdude -p attiny2313 -c stk200 -P /dev/parport0 -i 100 -U lfuse:w:0x64:m
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e910a
avrdude: reading input file "0x64"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.07s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0x64:
avrdude: load data lfuse data from input file 0x64:
avrdude: input file 0x64 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Teraz wszystko się udało.
Polecenie różni się od poprzedniego nie tylko wartością "lfuse"
(to raczej oczywiste, bo chodziło o zmianę) ale i dodaną opcją "-i" z
wartością 100. avrdude -p KONTROLER -c PROGRAMATOR -P PORT -i DELAY -U lfuse:w:0xXX:m
-U hfuse:w:0xYY:m
-U efuse:w:0xZZ:m
O poleceniu:
KONTROLER,
PROGRAMATOR,
PORT
były omówione wyżej.-i DELAY
jest opcjonalne (dla niskich częstotliwości zegara mikrokontrolera) i
nie ma sensu przy stosowaniu USBASP, który ma przełącznik spowalniający
SCK do 8kHz.w
oznacza operację zapisu0xXX,
0xYY,
0xZZ
to odpowiednio wartości szesnastkowe fusebitów w bajtach LOW, HIGH i EXTENDED.
m
każe pobrać wartości (0xXX, 0xYY, 0xZZ) ze standardowego wejścia. Czyli z wydanego przez nas polecenia.voytek@tay:~/Dokumenty/Canon/USB_Remote$ avrdude -v -p t2313 -c
stk200 -P /dev/parport0 -i 100 -U flash:w:"canon_remote.hex" -U
lfuse:w:0xA6:m
avrdude: Version 5.4, compiled on May 21 2007 at 21:35:45
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
System wide configuration file is "/etc/avrdude.conf"
User configuration file is "/home/voytek/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using
Port
: /dev/parport0
Using Programmer : stk200
Setting isp clock delay: 100
AVR
Part
: ATtiny2313
Chip Erase delay : 9000 us
PAGEL
: PD4
BS2
: PD6
RESET disposition : possible i/o
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
65 6
4 0 no
128 4 0
4000 4500 0xff 0xff
flash
65 6 32 0
yes 2048
32 64 4500 4500 0xff 0xff
signature 0
0 0 0
no
3 0
0 0 0 0x00 0x00
lock
0 0 0
0 no
1 0 0 9000
9000 0x00 0x00
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
calibration 0
0 0 0
no
2 0
0 0 0 0x00 0x00
Programmer Type : PPI
Description : STK200
VCC = (not used)
BUFF = 4,5
RESET = 9
SCK = 6
MOSI = 7
MISO = 10
ERR LED = 0
RDY LED = 0
PGM LED = 0
VFY LED = 0
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e910a
avrdude: safemode: lfuse reads as A6
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "canon_remote.hex"
avrdude: input file canon_remote.hex auto detected as Intel Hex
avrdude: writing flash (418 bytes):
Writing | ################################################## | 100% 7.51s
avrdude: 418 bytes of flash written
avrdude: verifying flash memory against canon_remote.hex:
avrdude: load data flash data from input file canon_remote.hex:
avrdude: input file canon_remote.hex auto detected as Intel Hex
avrdude: input file canon_remote.hex contains 418 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 7.09s
avrdude: verifying ...
avrdude: 418 bytes of flash verified
avrdude: reading input file "0xA6"
avrdude: writing lfuse (1 bytes):
Writing | ################################################## | 100% 0.02s
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xA6:
avrdude: load data lfuse data from input file 0xA6:
avrdude: input file 0xA6 contains 1 bytes
avrdude: reading on-chip lfuse data:
Reading | ################################################## | 100% 0.02s
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified
avrdude: safemode: lfuse reads as A6
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK
avrdude done. Thank you.
Polecenia można łączyć. -U flash:w:"canon_remote.hex"
I potem zmieniło fusebity:-U lfuse:w:0xA6:m