LoginSignup
3
3

More than 5 years have passed since last update.

Arduino M0とESP-WROOM-02を使うときに見落としがちな設定

Posted at

Arduino M0(Mo Pro)とESP-WROOM-02(ESP8266)をシリアル通信(ATコマンド)で使う際に必要なArduino IDEの設定方法をまとめました。設定せずとも動作するのですが、動作が不安定だったりサーバーから受け取った値が壊れたりするので必ず設定したほうが幸せになれます :innocent:

メモリリーク不具合を修正

Arduino M0はarduino.orgArduino IDE(2016/03/14時点の最新版は1.7.8)で開発するのですが、メモリリークする不具合があります。/hardware/arduino/samd/cores/arduino/USB/samd21_device.cの152行目を下記のように書き換えます。

for (i = 0; i < sizeof(usb_endpoint_table)/4; i++) { 
    (*(uint32_t *)((uint32_t *)(&usb_endpoint_table[0])+i)) = 0; 
}

バッファーサイズを上げる

\arduino-1.7.8\hardware\arduino\samd\cores\arduino\RingBuffer.hSERIAL_BUFFER_SIZEでシリアル通信時のデータのバッファーサイズを設定できます。初期では64が設定されていますが、ESP-WROOM-02とシリアル通信を行うと超えてしまうことがあります。そうすると、サーバーから受け取ったデータが更新されなかったりデータが壊れる恐れがあるので、256以上を設定します。

#define SERIAL_BUFFER_SIZE 256

まだまだ情報少ないですね

国内でESP-WROOM-02が発売されてまだ一年たたないこともあり、まだまだ情報少ないですね :sob: これからもコツコツ踏んだ地雷の共有は続けていこうと思います。

3
3
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
3
3