LoginSignup
2
2

More than 5 years have passed since last update.

AVRライタ USB-ASP2 のファームウェアをアップデートする

Last updated at Posted at 2017-07-29

概要

aitendoが販売しているAVRプログラマUSB-ASP2のファームウェアをアップデートする話です。
同じことで困っている人がいそうなので共有させていただきます。
USB-ASP2は、USBaspと呼ばれているタイプのプログラマです。2017年7月現在、USB-ASP2に焼かれているファームウェアは古いので、最新版にアップデートしたいのですが、そのためにはUSB-ASP2をセルフプログラミングモードにする必要があります。
USB-ASP2の場合、セルフプログラミングモードにする手段が公開されていないので調べました。

ポイント

USB-ASP2をセルフプログラミングモードにするには、裏側中央に見えている2つのスルーホールをショートさせれば良いです。
IMG_6218.JPG
(ブレッドボード用の最短のジャンパー線でショートさせています)
以上でございます。

物語

macOSからavrdudeでAVR(ATTiny10)を焼きたくて、aitendoの安価なAVRライタUSB-ASP2 を買いました。
USB-ASP2の動作確認のため、Arduino UNO R3 の ICSP ピンにつないで焼きテストしてみると、avrdudeが警告メッセージを吐きます。
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
「ん?ファームが古い?アップデートしたいなぁ。」と思い、いろいろ調べたところ、本家本元 Thomas Fischl 氏のページに最新(というか最終?)のfirmware (usbasp.2011-05-28.tar.gz)があることがわかりました。※追記:このファームではTiny10には書けませんでした
しかも、私がやりたいこと(Tiny10 に対して TPI で書き込む)のためには、この最新ファームにする必要があるみたいなのです。

色々なWebサイトを徘徊して、USBaspのファームウェアをArduinoUNO経由でアップデートする方法をいくつか探し出しました。
http://www.rogerclark.net/updating-firmware-on-usbasp-bought-from-ebay/
http://eleclog.quitsq.com/2013/03/arduinoispusbasp-b.html

結線方法などは分かったのですが、USB-ASP2をセルフプログラミングモードにする方法がわかりません。

セルフプログラミングモードにするためには、USBaspに乗っているATmega8の/RESET(1番ピン)と、USBaspの10ピンコネクタの/RESET(5番ピン)を接続する必要があります。
本家本元のUSBaspには、J2というジャンパーピンがあり、これをショートさせれば良いのですが、aitendoのUSB-ASP2にはそれが見当たりません。
(ちなみに、ターゲットにUSBの5Vを供給したいときにショートさせるJ1(JP1)はあります。R5の0Ω抵抗でショートしてあるように見えるけど。)

仕方がないので、恐る恐るテスターを当てて/RESETを探すと、裏のスルーホールに繋がっていることが判明。えいやっ、とスルーホールをショートさせて試したところ、無事成功しました。

いや、無事は、言い過ぎでした。
ArduinoISPに慣れていないので、firmwareの書き換えでいくつかハマりました。
こちらも紹介させていただきます。

  • avrdudeに指定する ISP 名 (-c オプション)は、arduinoではなく、avrisp を指定する。
  • avrdudeに -b 19200 で通信速度を明示指定する必要がある(デフォルトのままだとATmega8のDevice signature である0x1e9307 が読み出せずavrdude: Device signature = 0x000000になってしまう)。

少なくとも、成功例がありますよ、ということで、最後にログもご紹介させていただきます。

ご参考:macOSでの実行ログ
$ /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avrdude -C/Applications/Arduino.app/Contents/Java/hardware/tools/avr/etc/avrdude.conf -v -pm8 -cavrisp -P/dev/cu.usbmodem1411 -b 19200 -Uflash:w:/Users/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:01:35
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

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

         Using Port                    : /dev/cu.usbmodem1411
         Using Programmer              : avrisp
         Overriding Baud Rate          : 19200
         AVR Part                      : ATmega8
         Chip Erase delay              : 10000 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         4    20   128    0 no        512    4      0  9000  9000 0xff 0xff
           flash         33    10    64    0 yes      8192   64    128  4500  4500 0xff 0x00
           lfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  2000  2000 0x00 0x00
           efuse          0     0     0    0 no          0    0      0     0     0 0x00 0x00
           lock           0     0     0    0 no          1    0      0  2000  2000 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 : 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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9307 (probably m8)
avrdude: safemode: hfuse reads as C9
avrdude: safemode: Fuse reading not support by programmer.
              Safemode disabled.
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/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex"
avrdude: input file /Users/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: writing flash (4700 bytes):

Writing | ################################################## | 100% 6.67s

avrdude: 4700 bytes of flash written
avrdude: verifying flash memory against /Users/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex:
avrdude: load data flash data from input file /Users/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex:
avrdude: input file /Users/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex auto detected as Intel Hex
avrdude: input file /Users/odaki/Downloads/usbasp.2011-05-28/bin/firmware/usbasp.atmega8.2011-05-28.hex contains 4700 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 3.34s

avrdude: verifying ...
avrdude: 4700 bytes of flash verified

avrdude: safemode: hfuse reads as C9
avrdude: safemode: hfuse reads as C9
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode

avrdude done.  Thank you.

(追記)USB-ASP2に適用するファームウェアですが、本家のものではTiny10をTPIで焼けませんでした。
かなり試行錯誤しましたが、ぶらうあさんがアップロードされているファームウェア 20141019_mega8_usbisp.hex を使ったところ、ついにTiny10に書き込むことができました。
ぶらうあさん、ありがとうございます!

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2