avrdude
avrdude
windowsでの実行
platformioを入れて一度でもビルドしていればインストールされている
> pre
~/.platformio/packages/tool-avrdude/avrdude.exe
<<
bitbang modeでの接続
FT232を使ってbitbang modeで読み・書きをする
> pre
$ .platformio/packages/tool-avrdude/avrdude.exe -c diecimila -p m328pb -b4800 -U fuse:r:-:i -v
avrdude.exe: Version 6.3, compiled on Sep 12 2016 at 17:24:16
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\user\.platformio\packages\tool-avrdude\avrdude.conf"
Using Port : usb
Using Programmer : diecimila
Overriding Baud Rate : 4800
avrdude.exe: error: no libftdi or libusb support. Install libftdi1/libusb-1.0 or libftdi/libusb and run configure/make again.
avrdude.exe done. Thank you.
<<
avrdudeを自前でビルドしないとこれは解決できなそう・・ 面倒なのでbitbangはあきらめよう
ArduinoISPでの接続
fuse-bitの確認
> pre
$ ./app/avrdude-64/avrdude.exe -PCOM3 -c avrisp -p m328pb -b19200 -U fuse:r:-:i -v
avrdude.exe: Version 6.3-20171130
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "C:\Users\user\app\avrdude-64\avrdude.conf"
Using Port : COM3
Using Programmer : avrisp
Overriding Baud Rate : 19200
AVR Part : ATmega328PB
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 MaxW ReadBack ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 20 4 0 no 1024 4 0 3600 3600 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 4500 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 4500 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 4500 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.exe: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.07s
avrdude.exe: Device signature = 0x1e9516 (probably m328pb)
avrdude.exe: safemode: lfuse reads as 62
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as F9
"fuse" memory type not defined for part "ATmega328PB"
avrdude.exe: safemode: lfuse reads as 62
avrdude.exe: safemode: hfuse reads as DF
avrdude.exe: safemode: efuse reads as F9
avrdude.exe: safemode: Fuses OK (E:F9, H:DF, L:62)
avrdude.exe done. Thank you.
<<
> pre
./app/avrdude-64/avrdude.exe -PCOM3 -c avrisp -p m328pb -b19200 -U lfuse:w:0xe2:m -U hfuse:w:0xd8:m -U efuse:w:0x06:m
<<
> pre
./app/avrdude-64/avrdude.exe -PCOM3 -c avrisp -p m328pb -b19200 -U flash:w:/c/Users/user/work/repos/optiboot-inajob/optiboot/bootloaders/optiboot/optiboot_atmega328_pro_8MHz.hex
<<
efuse
最近は0xf9を書き込んでいる。
意味的には0x06に近い?もう一度見ておいた方が良い
0xfeが正解っぽい
これはBODの設定で0xfeだと 1.8V
HACHIBARのfuse
- lfuse 0xe2
- hfuse 0xd8
- efuse 0xfe
よくあるfuse設定
よく使うコマンド
fuseの確認
> code bash
$ ./avrdude.exe -c diecimila -p m328p -b4800 -U lfuse:r:con:h -U hfuse:r:con:h -U efuse:r:con:h
<<
fuseの書き込み
> code
$ ./avrdude.exe -c diecimila -p m328p -b4800 -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0xf9:m
<<
hexの書き込み
> code bash
./avrdude.exe -c diecimila -p m328p -b19200 -U flash:w:ATmegaBOOT_168_atmega328.hex -v
<<