# ファーム書き換え用の配線

ファームウェアを書き換えるための配線について解説します。

{% hint style="warning" %}
表面実装(SMD)版のモジュールを実装して、独自に基板設計される場合は、必ずファームウェアの書き換えを行える配線を基板上に用意してください。
{% endhint %}

{% hint style="info" %}
以下は TWELITE R2 (7pin) をプログラマとして利用することを前提に記載します。
{% endhint %}

## ピンについて

プログラムモードで用いる配線を以下に列挙します。これらの信号線をお客様設計の基板から引き出せるようにしておいてください。TWELITE R2の7ピンヘッダ(2.54mmピッチ)と同一のソケットを準備しておくとTWELITE R2を直接接続できます。

| **TWELITE R2** | **信号名** | **TWELITE DIP#** | **TWELITE SMD #** | **備考**                                                                                                                                                                                |
| -------------- | ------- | ---------------- | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| GND            | GND     | 1,14             | 20,28             | 電源供給のため（ピンが複数定義されているが、内部で接続されているため１本接続でも可）                                                                                                                                            |
| TXD            | DIO6    | 10               | 8                 | シリアル通信線（PC側はRX端子に接続)                                                                                                                                                                  |
| PRG            | SPIMISO | 7                | 2                 | 本品をLO(GND)にしてからリセットし、開放(またはHI) にするとプログラムモードに遷移する。                                                                                                                                     |
| RXD            | DIO7    | 3                | 9                 | シリアル通信線（PC側はTX端子に接続)                                                                                                                                                                  |
| RST            | RESETN  | 21               | 21                | モジュールをリセットする（配線しない場合は電源投入で代替できる）                                                                                                                                                      |
| VCC            | VCC     | 28               | 5                 | <p>TWELITE R2 からの電源供給 (3.3V) です。</p><p>※ 基板上の電源と衝突しないように設計してください。</p>                                                                                                                 |
| SET            | (DIO12) | 15               | 13                | <p>電源投入時にインタラクティブモードに遷移させるためのピンとして利用します。TWELITE PALなどではDIO12に割り当てています。</p><p>※ お客様のシステム要件に合わせて別のピンを割り当てても構いません。外部プログラム(TWELITE STAGEアプリなど)からは、SETピンをLO→リセットLO→リセットHI→といった制御を行います。</p> |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://twelite.gitbook.io/general/technical-info/progpins.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
