ArduinoにATMEGA88Pを積んでみる。
買ったまま使ってなかったATMEGA88PがあったのでArduinoのbootloaderを入れてみる。
http://www.geocities.jp/arduino_diecimila/index.html
http://www15.atwiki.jp/arduino/m/pages/39.html?guid=on
この辺りを参考に。
avrdude.confの記述確認。atmega88pが載ってること。
http://www.geocities.jp/arduino_diecimila/atmega88_2009_05_25.zip
をもらってきて、解凍。
ATmegaBOOT_88.hexを\serjtag-0.3\avrdude-serjtag\binaryにコピーしておく。
下準備はとりあえずこんだけ。
cd C:\serjtag-0.3\avrdude-serjtag\binary
C:\serjtag-0.3\avrdude-serjtag\binary>avrdude -c diecimila -P ft0 -p m88p -t -B 4800
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 5 mosi 6 reset 7
avrdude: drain OK
ft245r: bitclk 4800 -> ft baud 2400
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e930favrdude> erase
>>> erase
avrdude: erasing chip
ft245r: bitclk 4800 -> ft baud 2400avrdude> w efuse 0 0x00
>>> w efuse 0 0x00avrdude> w hfuse 0 0xdd
>>> w hfuse 0 0xddavrdude> w lfuse 0 0xff
>>> w lfuse 0 0xffavrdude> quit
C:\serjtag-0.3\avrdude-serjtag\binary> avrdude -c diecimila -P ft0 -p m88p -U flash:w:ATmegaBOOT_88.hex
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 5 mosi 6 reset 7
avrdude: drain OK
ft245r: bitclk 230400 -> ft baud 115200
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.02s
avrdude: Device signature = 0x1e930f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
ft245r: bitclk 230400 -> ft baud 115200
avrdude: reading input file "ATmegaBOOT_168_diecimila.hex"
avrdude: input file ATmegaBOOT_88.hex auto detected as Intel Hex
avrdude: writing flash (7918 bytes):Writing | ################################################## | 100% 145.75s
avrdude: 7918 bytes of flash written
avrdude: verifying flash memory against ATmegaBOOT_88.hex:
avrdude: load data flash data from input file ATmegaBOOT_88.hex:
avrdude: input file ATmegaBOOT_88.hex auto detected as Intel Hex
avrdude: input file ATmegaBOOT_88.hex contains 7918 bytes
avrdude: reading on-chip flash data:Reading | ################################################## | 100% 236.05s
avrdude: verifying ...
avrdude: 7918 bytes of flash verified
avrdude: safemode: Fuses OKavrdude done. Thank you.
C:\serjtag-0.3\avrdude-serjtag\binary>
C:\serjtag-0.3\avrdude-serjtag\binary>avrdude -c diecimila -P ft0 -p m88p -t
avrdude: BitBang OK
avrdude: pin assign miso 3 sck 5 mosi 6 reset 7
avrdude: drain OK
ft245r: bitclk 230400 -> ft baud 115200
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.00s
avrdude: Device signature = 0x1e930f
avrdude> w lock 0 0x0f
>>> w lock 0 0x0favrdude> quit
出来上がり。
最後にArduino/Contents/Resources/Java/hardware/boards.txtに
atmega88.name=Arduino Diecimila w/ ATmega88
atmega88.upload.protocol=stk500
atmega88.upload.maximum_size=6144
atmega88.upload.speed=19200
atmega88.bootloader.low_fuses=0xff
atmega88.bootloader.high_fuses=0xdd
atmega88.bootloader.extended_fuses=0x00
atmega88.bootloader.path=atmega88
atmega88.bootloader.file=ATmegaBOOT_88_diecimila.hex
atmega88.bootloader.unlock_bits=0x3F
atmega88.bootloader.lock_bits=0x0F
atmega88.build.mcu=atmega88
atmega88.build.f_cpu=16000000L
atmega88.build.core=arduino
を追加し、書き込みする時にTools->Board->Arduino Diecimila w/ ATmega88と指定してやる。
ちなみに6144 byteしかプログラムできないのであまり大規模なことは出来ない。
168Pだと14336 byte, 328だと30720 byte使える。