2016年6月14日火曜日

Arduino ISPを経由して、ATtiny13にロードする(2)

前回の記事で、Delayが時間通りにかからないことを書きました。
クロックが正しく設定されてないことが想定されます。

チップのCKSELを書き換えることで、クロックが変更できます。想定のクロックにするには、
Arduino IDEから、ブートローダ書き込みをします。
前回置いた hardware/では、これが失敗してました。

hardware/の修正版はこちら: https://github.com/nackon/arduino_attiny13


===

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9007
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 "/Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/dummy/dummy.hex"
avrdude: writing flash (0 bytes):

Writing | ################################################## | 100% 0.00s

avrdude: 0 bytes of flash written
avrdude: verifying flash memory against /Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/dummy/dummy.hex:
avrdude: load data flash data from input file /Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/dummy/dummy.hex:
avrdude: input file /Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/dummy/dummy.hex contains 0 bytes
avrdude: reading on-chip flash data:

ブートローダの書き込み中にエラーが発生しました。
Reading |

===


dummy.hexを0byteで書いて、0byteを読み出そうとしている?
dummy.hexは、0byteでもないですし、仮に0byteだとしてもそれを読みに行っているのはおかしいです。
また、ATTiny13a自体は、ブートローダをもたず、やりたいことは, CKSEL(Fuses)を書き込みたいだけですので、
boards.txtから、ブートローダの指定(dummy/dummy.hex)を削除してやりました。

===

↓以下の行をコメントアウトor削除:

# attiny13-8.bootloader.path=dummy
# attiny13-8.bootloader.file=dummy.hex

===

ブートローダのファイルの指定がないぞ、と怒られてはいますが、目的のhfuses/lfusesは書き出されています。
これで動作確認したところ、delayの時間がしっかり直っていました。

===


avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9007
avrdude: erasing chip
avrdude: reading input file "0xff"
avrdude: writing hfuse (1 bytes):

/Users/naoyuki/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Users/naoyuki/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -pattiny13 -cstk500v1 -P/dev/cu.usbmodem621 -b19200 -Uflash:w:/Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/{bootloader.path}/{bootloader.file}:i -e -Uhfuse:w:0xff:m -Ulfuse:w:0x7a:m
Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xff:
avrdude: load data hfuse data from input file 0xff:
avrdude: input file 0xff contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0x7a"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0x7a:
avrdude: load data lfuse data from input file 0x7a:
avrdude: input file 0x7a contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

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

avrdude done. Thank you.


avrdude: Version 6.0.1, compiled on Apr 14 2015 at 16:30:25
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2009 Joerg Wunsch

System wide configuration file is "/Users/naoyuki/Desktop/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf"
User configuration file is "/Users/naoyuki/.avrduderc"
User configuration file does not exist or is not a regular file, skipping

Using Port : /dev/cu.usbmodem621
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATtiny13
Chip Erase delay : 4000 us
PAGEL : P00
BS2 : P00
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 5 4 0 no 64 4 0 4000 4000 0xff 0xff
flash 65 6 32 0 yes 1024 32 32 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 4500 4500 0x00 0x00
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00
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

Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
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.02s

avrdude: Device signature = 0x1e9007
avrdude: erasing chip
avrdude: reading input file "/Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/{bootloader.path}/{bootloader.file}"
avrdude: can't open input file /Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/{bootloader.path}/{bootloader.file}: No such file or directory
avrdude: read from file '/Users/naoyuki/Documents/Arduino/hardware/attiny/avr/bootloaders/{bootloader.path}/{bootloader.file}' failed

avrdude done. Thank you.

ブートローダの書き込み中にエラーが発生しました。


===

0 件のコメント:

コメントを投稿