「BitBang Mode AVR-Writer on Mac」の編集履歴(バックアップ)一覧はこちら

BitBang Mode AVR-Writer on Mac」の最新版変更点

追加された行はこの色になります。

削除された行はこの色になります。

 『外付けAVRライタ無しでBootloaderを書き込む』
 http://www.geocities.jp/arduino_diecimila/bootloader/
+http://www.geocities.jp/arduino_diecimila/bootloader/index_old.html
 をMacでやりたい。
 
 環境は、
 -Arduino2009
 -macbook OSX 10.4.11
 です。
 
 *ドライバの準備
 **ダウンロード
 http://www.ftdichip.com/Drivers/D2XX.htm
 http://www.ftdichip.com/Drivers/D2XX/MacOSX/UniBin/Universal%20D2XX0.1.6.dmg
 
 **インストール
 ReadMe.rtfに従ってインストールする。
 (libftd2xx.0.1.6.dylibを/usr/local/libにコピー。
 libftd2xx.0.1.6.dylib -> libftd2xx.dylib にシンボリックリンク。
 ftd2xx.hとWinTypes.hを/usr/local/includeにコピー。)
  % ls -l /usr/local/lib/libftd2xx*
  -rwxr-xr-x   1 root  wheel  212748  2 24 01:47 /usr/local/lib/libftd2xx.0.1.6.dylib
  lrwxr-xr-x   1 root  wheel      36  2 24 01:50 /usr/local/lib/libftd2xx.dylib -> /usr/local/lib/libftd2xx.0.1.6.dylib
  
  % ls -l /usr/local/include/(ftd*|Win*) 
  -rwxr--r--   1 root  wheel   2230  2 24 01:49 /usr/local/include/WinTypes.h
  -rwxr-xr-x   1 root  wheel  23433  2 24 01:48 /usr/local/include/ftd2xx.h
 
 **テスト
  (成功例)
  % cd D2XX/Samples/BitMode
  % make
  % ./bitmode 
  ucMode = 0x0
  % cd D2XX/Samples/Simple
  % make
  % ./simple
  Device 0 Serial Number - A9005bvI
  Opened device A9005bvI
  ^CClosed device
 ↑こうなれば成功なのだが、Arduinoのシリアルドライバがインストールされている場合うまくいかない。
 
  (失敗例)
  % cd D2XX/Samples/BitMode
  % ./bitmode                                                        
  FT_Open(0) failed = 3
  % cd D2XX/Samples/Simple
  % ./simple 
  Device 0 Serial Number - A9005bvI
  Error FT_OpenEx(3), device
 
 USBシリアルドライバとD2XXドライバは排他的なので同時に使うことができません。
 ターミナルから以下のコマンドでUSBシリアルドライバをアンロード/ロードできます。
  sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext
  sudo kextload   /System/Library/Extensions/FTDIUSBSerialDriver.kext
 (参考:http://arms22.blog91.fc2.com/blog-entry-148.html)
 
  (アンロード&テスト)
  sudo kextunload /System/Library/Extensions/FTDIUSBSerialDriver.kext
  % cd D2XX/Samples/BitMode
  % ./bitmode 
  ucMode = 0x0
 
 bitbangを使い終わったらふたたびArduinoを使えるように、
  sudo kextload   /System/Library/Extensions/FTDIUSBSerialDriver.kext
 としてUSBシリアルドライバをロードしておきます。
 
 *serjtag-0.3 + avrdude-5.3.1のビルド
  mkdir mac_bitbang
  cd mac_bitbang
  wget http://www.nmj.sakura.ne.jp/suz-avr/serjtag/serjtag-0.3.tar.gz
  # wget http://www.geocities.jp/arduino_diecimila/bootloader/files/serjtag-0.3.tar.gz
  wget http://ftp.twaren.net/Unix/NonGNU/avrdude/avrdude-5.3.1.tar.gz
  # MD5 (avrdude-5.3.1.tar.gz) = 58c2be9f7a864b930ed9e6f1858f5cc7
  # MD5 (serjtag-0.3.tar.gz) = 7228de34ad8221598401cd631dd6f55e
  tar xvzf avrdude-5.3.1.tar.gz
  tar xvzf serjtag-0.3.tar.gz
  cd avrdude-5.3.1
  patch -p1 < ../serjtag-0.3/avrdude-serjtag/src/avrdude-5.3.1-usb910.patch
  patch -p1 < ../serjtag-0.3/avrdude-serjtag/src/avrdude-5.3.1-avr910d.patch
  patch -p1 < ../serjtag-0.3/avrdude-serjtag/src/avrdude-5.3.1-serjtag.patch
  patch -p1 < ../serjtag-0.3/avrdude-serjtag/src/avrdude-5.3.1-ft245r.patch
  patch -p1 < ../serjtag-0.3/avrdude-serjtag/src/avrdude-5.3.1-baud.patch
  mv ser_posix.c ser_posix.c.ORIG
  grep -v B3000000 ser_posix.c.ORIG > ser_posix.c
  ./configure CFLAGS="-g -O2 -DSUPPORT_FT245R" LIBS="-lftd2xx"
  make
  ./avrdude -v 
 ↑ターミナルにコピペしたらOK
 
 *配線
 |色|Arduino|     |tiny2313V|mega88|mega88p|
 |赤|5V     |Vcc  |20       |7,20  |       |
 |黒|Gnd    |GND  |10       |8,22  |       |
 |青|(X3:2) |SCK  |19       |19    |       |
 |緑|(X3:1) |MISO |18       |18    |       |
 |黄|(X3:3) |MOSI |17       |17    |       |
 |白|(X3:4) |RESET|1        |1     |       |
 
 *avrdude.confを編集
-(http://www.geocities.jp/arduino_diecimila/bootloader/index_old.html を参考に。) 
---------
  #arduino diecimila
  programmer
   id="diecimila";
   desc  = "FT232R Synchronous BitBang";
   type  = ft245r;
   miso  = 3;  # CTS X3(1)
   sck   = 5;  # DSR X3(2)
   mosi  = 6;  # DCD X3(3)
   reset = 7;  # RI  X3(4)
  ;
---------
+追加する。
 
 *実行
  ~/tmp/mac_bitbang/avrdude-5.3.1/avrdude -C ~/tmp/mac_bitbang/avrdude-5.3.1/avrdude.conf -c diecimila -p t2313 -vv -B 4800
  ~/tmp/mac_bitbang/avrdude-5.3.1/avrdude -C ~/tmp/mac_bitbang/avrdude-5.3.1/avrdude.conf -c diecimila -p t2313 -vv -B 4800 -U flash:w:main.hex:i
 
 *リセットが解除されない
 なんかリセットが常にLOWのような気がする。
 プルアップ10kを付けてもだめ。
 配線を外すと書き込んだプログラムが動き始める。
 
 
 *うごかないときは
 ReadMe.rtfにヒントがあった。
  Q. Cannot open a port even though installation has been successful.
  A1. This is possibly due to the FTDI serial driver holding the port with your VID and PID. Solution is to uninstall
  the serial driver (see www.ftdichip.com knowledgebase on how to do this). To completely eradicate the possibility of
  this occurring in future it is recommended a new VID and PID is used to distinguish between devices.
  A2. Another possibility is an incorrect VID/PID. Try changing your application to use the FT_SetVIDPID API call to
  quickly determine if this is the case.
 http://www.ftdichip.com/Support/Knowledgebase/macosxuninstallingvcp.htm
 
 
 *参考サイト
+http://www.geocities.jp/arduino_diecimila/bootloader/
+http://www.geocities.jp/arduino_diecimila/bootloader/index_old.html
 http://suz-avr.sblo.jp/article/27131001.html

|新しいページ|検索|ページ一覧|RSS|@ウィキご利用ガイド | 管理者にお問合せ
|ログイン|