現: 2024-12-24 (火) 16:34:26 yuji Deleted an attach file: nano2.png at 2025-01-15 (水) 05:49:42, Deleted an attach file: uno2.png at 2025-01-15 (水) 05:49:54, Deleted an attach file: nano.png at 2025-01-15 (水) 05:50:09, Deleted an attach file: uno.png at 2025-01-15 (水) 05:50:25 |
|||
---|---|---|---|
Line 1: | Line 1: | ||
+ | * Arduino as ISP [#ra5d9686] | ||
+ | Arduino UnoやNano等のボードにAVR Writer化するArduino as ISPスケッチを書き込んで,AVR Writerが作れる。~ | ||
+ | 専用のAVR Writerが手元にないけどArduinoボードはあるという場合に,自作のAVRボードなどにプログラムを書き込むときに手軽に利用できる。 | ||
+ | |||
+ | ** Arduino ISPスケッチを書き込む [#m880b127] | ||
+ | Aruduino IDEを使っていてArduino Uno等をAVRライターにする場合,ファイル>スケッチ例>11.ArduinoISPのArduinoISPをロードし,ターゲットボードにスケッチを書き込む。~ | ||
+ | |||
+ | ** AVR Writerとして使用するピン [#ac686f02] | ||
+ | *** Arduino Unoの使用ピン [#je06063f] | ||
+ | //#ref(uno.png,,30%) | ||
+ | |ピン|信号|h | ||
+ | |GND |GND | | ||
+ | |13 |SCK | | ||
+ | |12 |MISO| | ||
+ | |11 |MOSI| | ||
+ | |10 |RST | | ||
+ | |5V |VCC | | ||
+ | 次の接続も同じ。~ | ||
+ | //#ref(uno2.png,,30%) | ||
+ | |ピン|信号|h | ||
+ | |ICSP 1|MISO| | ||
+ | |ICSP 2|VCC | | ||
+ | |ICSP 3|SCK | | ||
+ | |ICSP 4|MOSI| | ||
+ | |10 |RST | | ||
+ | |ICSP 6|GND | | ||
+ | |||
+ | *** Arduino Nanoの使用ピン [#mcc89db9] | ||
+ | //#ref(nano.png,,30%) | ||
+ | |ピン|信号|h | ||
+ | |GND |GND | | ||
+ | |13 |SCK | | ||
+ | |12 |MISO| | ||
+ | |11 |MOSI| | ||
+ | |10 |RST | | ||
+ | |5V |VCC | | ||
+ | 次の接続も同じ。UNO等とはICSPコネクタの向きが逆。~ | ||
+ | //#ref(nano2.png,,30%) | ||
+ | |ピン|信号|h | ||
+ | |ICSP 1|MISO| | ||
+ | |ICSP 2|VCC | | ||
+ | |ICSP 3|SCK | | ||
+ | |ICSP 4|MOSI| | ||
+ | |10 |RST | | ||
+ | |ICSP 6|GND | | ||
+ | |||
+ | *** Arduino IDEで使用 [#accf80d1] | ||
+ | Arduino IDEからArduino as ISPを使用する。~ | ||
+ | |||
+ | ''%LocalAppData%\Arduino15\packages\arduino\hardware\avr\1.8.5\programmers.txt''ファイルに,以下の定義があることを確認する。なければ追加する。~ | ||
+ | arduinoasisp.name=Arduino as ISP | ||
+ | arduinoasisp.communication=serial | ||
+ | arduinoasisp.protocol=stk500v1 | ||
+ | arduinoasisp.speed=19200 | ||
+ | arduinoasisp.program.protocol=stk500v1 | ||
+ | arduinoasisp.program.speed=19200 | ||
+ | arduinoasisp.program.tool=avrdude | ||
+ | arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed} | ||
+ | の後に以下を追加 | ||
+ | arduinoasisp2.name=Arduino as ISP2 | ||
+ | arduinoasisp2.communication=serial | ||
+ | arduinoasisp2.protocol=arduino | ||
+ | arduinoasisp2.speed=19200 | ||
+ | arduinoasisp2.program.protocol=arduino | ||
+ | arduinoasisp2.program.speed=19200 | ||
+ | arduinoasisp2.program.tool=avrdude | ||
+ | arduinoasisp2.program.extra_params=-P{serial.port} -b{program.speed} | ||
+ | |||
+ | これで,bootloaderをArduino IDEで書き込むときなどで,Arduino as ISP 2が使えるようになる。~ | ||
+ | |||
+ | *** bootloaderを書き込む [#zb057d00] | ||
+ | ターゲットボードにbootloaderを書き込む手順。~ | ||
+ | - 上記で用意したArduino as ISPとターゲットボードを接続する。上記の画像。~ | ||
+ | - Arduino as ISPボードをUSBケーブルでPCと接続する。~ | ||
+ | ターゲットボードの電源はArduino as ISPから供給するので,ターゲットボードには電源(USBケーブル等)は接続しない。~ | ||
+ | - Arduino IDEのツール>ボードでターゲットボードを指定する。~ | ||
+ | ボードによって,ツール>プロセッサでターゲットボードのクロック等を指定する。~ | ||
+ | - ツール>シリアルポートでArduino as ISPのシリアルポートを指定する。~ | ||
+ | - 書き込み装置にArduino as ISP2を指定する。~ | ||
+ | - ブートローダーを書き込むをクリックする | ||
+ | これでbootloaderがターゲットボードに書き込まれる。~ | ||
+ | |||
+ | Arduino as ISPボードが5Vで,ターゲットボードが3.3Vでは使用できない。最悪壊れることがある。~ | ||
+ | Arduino as ISPボードが3.3V,ターゲットボードが5Vの場合は,うまくいくことが多い。 |