Top View


Author Yuhei Okazaki

macOS CatalinaのArduino IDEでM5StickCに書き込みができない問題の解決方法

2020/02/13

Table of Contents

問題

macOS CatalinaのArduino IDEでM5StickCに書き込みができない問題が発生しました。

Arduino IDEで「マイコンボードに書き込む」を実行すると、以下のようなエラーが発生します。

esptool.py v2.8-dev
Serial port /dev/cu.usbserial-xxxxxxx
Connecting........_____....._____....._____....._____....._____....._____....._____

A fatal error occurred: Failed to connect to ESP32: Timed out waiting for packet header

macOS Mojaveのときは問題が発生しておらず、昨年秋にCatalinaにアップデートしたタイミングで発生するようになりました。

解決策

解決策は3つあります。

解決策1で現象は回避できるのですが、操作が煩わしく暫定策です。
解決策2はネットで見つけた記事で「解決した」との記載がありましたが私の環境では解決せず。
解決策3にて問題が解消しました。

解決策1. M5StickCのG0とGNDを接続して書き込む

写真のように、M5StickCのG0とGNDをジャンパ線で接続すると、書き込みモードを強制できます。この状態で書き込み操作することで、現象を回避できます。

M5StickCのG0とGND

ただし、書き込み完了後に電源OFF→ONが必須なのと、ジャンパ線を接続したままではプログラムを起動できない点が不便です。書き込む度にジャンパ線の取り付け→取り外し→電源OFF→電源ONが発生し、開発効率が悪いです。

解決策2. CP210x USB - UART ブリッジ VCP ドライバの最新版をインストール

こちらのサイトの「Download for Macintosh OSX」から最新版のVCPをダウンロードしてインストールします。

ただし、私の環境ではこの方法で問題は改善しませんでした。

解決策3. M5StickCのUSBコントローラーのファームウェアを更新する

※ファームウェアの更新に失敗すると、M5StickCにプログラムを書き込めなくなる可能性があるので自己責任で実施ください。

こちらのサイトからUpload Toolをダウンロードします。

※2020/05/04 追記
Upload ToolのURLがリンク切れしているようです。
以下URLからダウンロードください。
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/software/Updater_FW20200114_A2_BTV231

以下のようにUpload Toolに実行権限を付与します。

chmod +x ch552Updater_FW20200114_A2_BTV231

M5StickCをUSBケーブルでMacと接続し、Upload ToolをFinder上でダブルクリックし起動すると更新が開始されます。「Press enter to continue . . .」と表示されたらEnterキーを押しましょう。

 /Users/yokazaki/ch552Updater_FW20200114_A2_BTV231 ; exit;

==================== M5 Serial Converter Firmware Updater ====================
    
    FW Version: FW20200114_A2

    This is only for update M5StickC or M5Atom Series USB Controller's Firmware 
, using it for any other purpose may cause damage to your devices.

    When you are using this software, make sure you have a reliable connection 
to your device. Any disruption during the process will cause the device 
not functioning.


                        NO WARRANTIES
To the extent permitted by applicable law, neither wsdot,
nor any person, either expressly or implicitly, warrants any aspect of
this software or program, including any output or results of this software
or program. Unless agreed to in writing. This software and program is
being provided "as is", without any warranty of any type or nature,
either express or implied, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose,
and any warranty that this software or program is free from defects.
==========================================================================

Press enter to continue . . .


Detecting M5Stack products.
Find M5Stack products.
Kernel driver deteched.
Apply magic success.
Waiting for device in DFU mode....
Find M5Stack device in DFU mode.
Claim interface success.
Starting flash routine.
Sending Stage1...
Reading Config...
BTVER: V2.31
Writing Magic...A: 0x2c, B: 0x7e
Erasing Chip...
Unpacking payload...
Verifying the payload...
Packing the payload...
Start sending new firmware...
Sending to device, 4032/4032
Start verifying new firmware...
Sending to device, 4032/4032
Firmware verified, end flashing.
Resetting to run new firmware.
Have Fun :p

[プロセスが完了しました]

[プロセスが完了しました]と表示されたら、Upload Toolを終了してOKです。

動作確認

Arduino IDEからプログラムを書き込むことができました。

Arduino IDEでM5StickCに書き込み

これでスピーディに開発できそうです。

参考

Yuhei Okazaki

Yuhei Okazaki

Twitter X

2018年の年明けに組込み畑からやってきた、2児の父 兼 Webエンジニアです。 mockmockの開発・運用を担当しており、組込みエンジニア時代の経験を活かしてデバイスをプログラミングしたり、簡易的なIoTシステムを作ったりしています。主な開発言語はRuby、時々Go。