# FTDIドライバー

# FTDIドライバー

##### FTDIドライバー

  
EPS8266をOS X El capten 上のArduionで開発するときシリアルモニタへ「Serial.print/Serial.print」で出力すると、途中で出力されなくなってしまう問題に遭遇したので、そのテスト結果と対処方法をまとめました。  
   
作成日時 2016-05-09 19:20 更新日時 2016-05-10 12:,09

---

##### 【現象】

  
EPS8266をAdruinoで開発するときにいろんなメッセージをシリアルモニタへ「Serial.print/Serial.print」で出力していたのですが、その出力結果が次のように途中で出力されなくなってしまう状態に遭遇しました。

##### 【動作環境】

PC側  
・MacPro 2013 (OS X 10..4.11 (15E65))  
Arduino 側  
・Arduino SDK (Arduino 1.6.8)  
・EPS-WROOM-02 ボード

##### 【出力例】

異常な出力例と正常な出力例を示します。  
シリアルモニタへは本来は「------」の後に「setup() start」と続き、最後の「------ setup() end ------」で出力されるのです。ところが、何故か途中でシリアルモニタへの出力が途切れてしまっています。プログラムに問題が発生して例外で止まっているとかではなく、プログラムは正常に動作しているようでシリアルモニタへの出力が出ていない状況です。

   
\--- 異常な出力例 --- ここから  
<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

\------  
-&gt;&gt;-- ここまで  
   
\--- 正常な出力例 --- ここから  
<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

<span style="color: rgb(53, 152, 219);">------ setup() start ------</span>  
<span style="color: rgb(53, 152, 219);">print test 01</span>  
<span style="color: rgb(53, 152, 219);">print test 02</span>  
<span style="color: rgb(53, 152, 219);">print test 03</span>  
<span style="color: rgb(53, 152, 219);">print test 04</span>  
<span style="color: rgb(53, 152, 219);">print test 05</span>  
<span style="color: rgb(53, 152, 219);">print test 06</span>  
<span style="color: rgb(53, 152, 219);">print test 07</span>  
<span style="color: rgb(53, 152, 219);">print test 08</span>  
<span style="color: rgb(53, 152, 219);">print test 09</span>  
<span style="color: rgb(53, 152, 219);">print test 10</span>  
<span style="color: rgb(53, 152, 219);">------ setup() end ------</span>

-&gt;&gt;-- ここまで

# テスト結果

##### 【概要】

最初は、ハードウエアとかソフトウエア(SDK)の不備などを疑って、EPS8266搭載ボードを交換したり、USBのシリアル通信ハードを変えたり、Arduinoの出力プログラムを修正したり、SDKのバージョンを変えて問題を回避しできないかと試みていました。しかし、一向に問題を解決出来ませんでした。  
   
また、試しにArduino UNO R3 (arduino.cc製)に接続したところ問題無く出力しています。  
   
これまでは、OS X El captenになってからアップル社製FTDIドライバーのみで開発して来ました。特に問題が無かったのですが、試しにFTDI chipsのFTDIドライバー(Mac OS X 10.9 and above/ 2015-04-15/ version 2.3)と入れ替えたところ問題無く出力できるようになりました。ドライバーの問題か？、ということで、次のパターンでシリアルモニタへの出力テストをしてみました。

##### 【テスト結果】

========================  
使用ボード: EPS-WROOM-02 開発ボード (スイッチサイエンス社製)  
 [ https://www.switch-science.com/catalog/2500/](https://www.switch-science.com/catalog/2500/)  
ボード上のシリアルIF-IC: FT231XS (on Borad)

\*\*\*\*\*\*\*\*\*\*  
使用ドライバー: com.FTDI.driver.FTDIUSBSerialDriver

シリアル結果  
説明:  
・全て正しく出力

<span style="color: rgb(53, 152, 219);">\[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

<span style="color: rgb(53, 152, 219);">------ setup() start ------</span>  
<span style="color: rgb(53, 152, 219);">print test 01</span>  
<span style="color: rgb(53, 152, 219);">print test 02</span>  
<span style="color: rgb(53, 152, 219);">print test 03</span>  
<span style="color: rgb(53, 152, 219);">print test 04</span>  
<span style="color: rgb(53, 152, 219);">print test 05</span>  
<span style="color: rgb(53, 152, 219);">print test 06</span>  
<span style="color: rgb(53, 152, 219);">print test 07</span>  
<span style="color: rgb(53, 152, 219);">print test 08</span>  
<span style="color: rgb(53, 152, 219);">print test 09</span>  
<span style="color: rgb(53, 152, 219);">print test 10</span>  
<span style="color: rgb(53, 152, 219);">------ setup() end ------</span>

\*\*\*\*\*\*\*\*\*\*  
使用ドライバー: com.apple.driver.AppleUSBFTDI

シリアル結果  
説明:  
・途中で途切れる  
・プログラムのダウンロードと実行は行われているようだ

  
<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

\------

========================  
使用ボード: Board1 ver.1.0 (KURAHASHIYA製)  
 [ https://www.switch-science.com/catalog/2696/](https://www.switch-science.com/catalog/2696/)  
 [http://jiwashin.blogspot.jp/p/esp-wroom-02-board1.html](http://jiwashin.blogspot.jp/p/esp-wroom-02-board1.html)  
シリアルIF-IC: FT232RL  
 USBシリアルIF: 秋月電子通商 FT232RL USB シリアル変換モジュール  
 [http://akizukidenshi.com/catalog/g/gK-01977/](http://akizukidenshi.com/catalog/g/gK-01977/)

\*\*\*\*\*\*\*\*\*\*  
使用ドライバー: com.FTDI.driver.FTDIUSBSerialDriver

シリアル結果  
説明:  
・全て正しく出力

  
<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

<span style="color: rgb(53, 152, 219);">------ setup() start ------</span>  
<span style="color: rgb(53, 152, 219);">print test 01</span>  
<span style="color: rgb(53, 152, 219);">print test 02</span>  
<span style="color: rgb(53, 152, 219);">print test 03</span>  
<span style="color: rgb(53, 152, 219);">print test 04</span>  
<span style="color: rgb(53, 152, 219);">print test 05</span>  
<span style="color: rgb(53, 152, 219);">print test 06</span>  
<span style="color: rgb(53, 152, 219);">print test 07</span>  
<span style="color: rgb(53, 152, 219);">print test 08</span>  
<span style="color: rgb(53, 152, 219);">print test 09</span>  
<span style="color: rgb(53, 152, 219);">print test 10</span>  
<span style="color: rgb(53, 152, 219);">------ setup() end ------</span>

  
\*\*\*\*\*\*\*\*\*\*  
使用ドライバー: com.apple.driver.AppleUSBFTDI

シリアル結果  
説明:  
・途中で途切れる  
・プログラムのダウンロードと実行は行われているようだ

  
<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

\------

========================  
使用ボード: Arduino UNO R3 (arduino.cc製)  
 [https://www.arduino.cc/en/main/arduinoBoardUno](https://www.arduino.cc/en/main/arduinoBoardUno)  
 https://www.switch-science.com/catalog/789/  
シリアルIF-IC: Atmega16U2 (on Borad)

\*\*\*\*\*\*\*\*\*\*  
使用ドライバー: com.FTDI.driver.FTDIUSBSerialDriver

シリアル結果  
説明:  
・全て正しく出力

  
<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

<span style="color: rgb(53, 152, 219);">------ setup() start ------</span>  
<span style="color: rgb(53, 152, 219);">print test 01</span>  
<span style="color: rgb(53, 152, 219);">print test 02</span>  
<span style="color: rgb(53, 152, 219);">print test 03</span>  
<span style="color: rgb(53, 152, 219);">print test 04</span>  
<span style="color: rgb(53, 152, 219);">print test 05</span>  
<span style="color: rgb(53, 152, 219);">print test 06</span>  
<span style="color: rgb(53, 152, 219);">print test 07</span>  
<span style="color: rgb(53, 152, 219);">print test 08</span>  
<span style="color: rgb(53, 152, 219);">print test 09</span>  
<span style="color: rgb(53, 152, 219);">print test 10</span>  
<span style="color: rgb(53, 152, 219);">------ setup() end ------</span>

  
\*\*\*\*\*\*\*\*\*\*  
使用ドライバー: com.apple.driver.AppleUSBFTDI

シリアル結果  
説明:  
・全て正しく出力

<span style="color: rgb(53, 152, 219);"> \[\[ LED Chika 2016-05-08 19:19 A10 Objs.,Inc. \]\]</span>

<span style="color: rgb(53, 152, 219);">------ setup() start ------</span>  
<span style="color: rgb(53, 152, 219);">print test 01</span>  
<span style="color: rgb(53, 152, 219);">print test 02</span>  
<span style="color: rgb(53, 152, 219);">print test 03</span>  
<span style="color: rgb(53, 152, 219);">print test 04</span>  
<span style="color: rgb(53, 152, 219);">print test 05</span>  
<span style="color: rgb(53, 152, 219);">print test 06</span>  
<span style="color: rgb(53, 152, 219);">print test 07</span>  
<span style="color: rgb(53, 152, 219);">print test 08</span>  
<span style="color: rgb(53, 152, 219);">print test 09</span>  
<span style="color: rgb(53, 152, 219);">print test 10</span>  
<span style="color: rgb(53, 152, 219);">------ setup() end ------</span>

========================  
【対処方法】  
・EPS8266使用をしたOS X El capten上のArduion開発環境でシリアルモニタの  
 出力には当面の間、次のドライバーを使用する事にしました。  
 FTDI chipsのFTDIドライバー(Mac OS X 10.9 and above/ 2015-04-15/ version 2.3)  
[http://www.ftdichip.com/Drivers/VCP.htm](http://www.ftdichip.com/Drivers/VCP.htm)

# テストコード

```c++
/*
 * Lチカ  Arduion
 *
 *
 * このスケッチは。Arduinoの基本テスト用
 *
 * 動作確認済みボード一覧
 *    https://en.wikipedia.org/wiki/List_of_Arduino_boards_and_compatible_systems
 *   
 *    Arduion UNO R3        __AVR_ATmega328P__
 *    EPS8266
 *
 *
 */

#include <Arduino.h>
#if defined(__AVR_ATmega328P__)
#else
#include <ESP8266WiFi.h>
#endif

/*
 *    アプリケーション情報
 */
#define appName     "LED Chika"
#define appDates    "2016-05-08 19:19"
#define appInitMsg  "A10 Objs.,Inc."
void printAppInfo () {
  Serial.println("");
  Serial.println("");
  Serial.print(" [[ ");
  Serial.print(appName);
  Serial.print(" ");
  Serial.print(appDates);
  Serial.print(" ");
  Serial.print(appInitMsg);
  Serial.println(" ]]");
  Serial.println("");
}

/*
 * 各種定義
 */
//  PIN 定義
#if defined(__AVR_ATmega328P__)
const int PORT_LED        = 13;
#else
const int PORT_LED        = 13;
#endif

//  通信 定義
volatile static long serialPortSpeeds = 115200;     //  PCのシリアルポートのスピード   921600 or 115200 or 74880
//  LED 点滅スピード
volatile static long LEDflashingSpeed = 100;        //  ms

/*
 * 初期化
 */
void setup() {
  // put your setup code here, to run once:
  Serial.begin(serialPortSpeeds);
  printAppInfo();
 
  Serial.println("------ setup() start ------");

  Serial.println("print test 01");
  Serial.println("print test 02");
  Serial.println("print test 03");
  Serial.println("print test 04");
  Serial.println("print test 05");
  Serial.println("print test 06");
  Serial.println("print test 07");
  Serial.println("print test 08");
  Serial.println("print test 09");
  Serial.println("print test 10");


  pinMode(PORT_LED,OUTPUT);

  Serial.println("------ setup() end  ------");
}

/*
 * メインループ
 */
void loop() {
  // put your main code here, to run repeatedly:
  digitalWrite(PORT_LED,HIGH);
  delay(LEDflashingSpeed);
  digitalWrite(PORT_LED,LOW);
  delay(LEDflashingSpeed);

}
```