目次: Arduino
M5Stackというボードが電子工作に便利らしいという話を聞き、M5 Core2とM5Stamp C3という小型のボードを買いました。Core2の方は機能豊富な分、お値段もそこそこ(8,000円くらい)します。M5Stampは安い(1,300円くらい)です。
M5Stackのサイト(M5Stack document PLATFORMのページ)を見ると、AIなど特定用途向けを外すと開発環境は4つあるようです。多いなあ。派閥争い中でしょうか。
1番目に表示されているUIFlowが一番おススメなのでしょうけど、残念ながらUIFlowはM5Stamp C3に対応していないようです。2番目に表示されていたArduino IDEにしました。Arduino IDEを使うなら素直にArduinoボードを買った方が良かったかな、まあいいか。
M5StackシリーズはいずれもEspressifのESP32ファミリーのSoC(IoT向けの小規模SoC)を採用しています。CPUとSRAM、一通りの低速系I/O I2C, SPI, I2Sなどの他に、Wi-FiやBluetoothに対応していて素晴らしいSoCです。無線技術に強いEspressifならではですね。
私が購入したM5Stamp C3はESP32-C3というSoCを採用しています。ESP32シリーズの中でC3は割と後発らしく、CPUが従来のXtensaではなくRISC-Vに変更されています。
新しいせいかCPUアーキを変更したせいか知りませんが、Arduino IDEでデバッグしようとしてもOpenOCDが繋がらないとエラーが出てデバッグできないです。ログを全部載せると長いので別ファイル( ログ全部)にします。
Debug: 215 114 command.c:155 script_debug(): command - init Debug: 216 115 command.c:155 script_debug(): command - target init Debug: 217 115 command.c:155 script_debug(): command - target names Debug: 218 115 command.c:155 script_debug(): command - esp32c3 cget -event gdb-flash-erase-start Debug: 219 115 command.c:155 script_debug(): command - esp32c3 configure -event gdb-flash-erase-start reset init Debug: 220 115 command.c:155 script_debug(): command - esp32c3 cget -event gdb-flash-write-end Debug: 221 115 command.c:155 script_debug(): command - esp32c3 configure -event gdb-flash-write-end reset halt Debug: 222 115 command.c:155 script_debug(): command - esp32c3 cget -event gdb-attach Debug: 223 116 target.c:1659 handle_target_init_command(): Initializing targets... Debug: 224 116 riscv.c:444 riscv_init_target(): riscv_init_target() Debug: 225 116 semihosting_common.c:107 semihosting_common_init(): Error: 226 131 esp_usb_jtag.c:642 esp_usb_jtag_init(): esp_usb_jtag: could not find or open device! ★JTAGが見つからない?? Debug: 227 131 command.c:545 run_command(): Command 'init' failed with error code -4 User : 228 131 command.c:608 command_run_line(): Error: 229 131 riscv.c:1755 riscv_get_gdb_arch(): Unsupported xlen: -1 Error: 230 131 esp_semihosting.c:67 target_to_esp_semihost_data(): Unknown target arch! Debug: 231 131 riscv.c:490 riscv_deinit_target(): riscv_deinit_target() Debug: 232 132 target.c:2225 target_free_all_working_areas_restore(): freeing all working areas
エラーの前後だけ切り出すとこんな感じです。JTAGデバイスが見つからんと言っているように見えますが、どうしたら良いか全くわかりません。しばらくはprintfデバッグするしかないようです。M5Stamp C3はM5Stackシリーズを初めて使う人が買うべきボードではなかった??
M5Stackについて書かれたブログやコードを見ていると、外部ライブラリ(AdaFruit, Lovyan GFXとか)を使う場合と、Arduino-ESP32ライブラリを使う場合があるようです。
Arduino-ESP32ライブラリのドキュメントはEspressifが公開しています(Arduino-ESP32 2.0.14 documentation)。このライブラリはOSSでGitHubにてソースコードが公開されています(Arduino core for the ESP32 - GitHub)。
どうやってライブラリを入れ替えるのかわかりませんけど、Arduinoライブラリの中を見ることはできそうです。ありがたいですね。
Arduino-ESP32ライブラリはESP32 IDF(IoT Development Framework)というEspressif独自APIのライブラリを使用して実装されているようです。ドキュメントはやはりEspressifが公開しています(ESP-IDF Programming Guide)。GitHubにてソースコードも公開されています(Espressif IoT Development Framework - GitHub)。
このライブラリはちゃんと見てないですが、バイナリ(*.a)しかない部分もあって若干意味不明に見えます……。まあライブラリの表面だけだとしてもソースコードがあってありがたいです。きっと。
< | 2024 | > | ||||
<< | < | 01 | > | >> | ||
日 | 月 | 火 | 水 | 木 | 金 | 土 |
- | 1 | 2 | 3 | 4 | 5 | 6 |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 | - | - | - |
合計:
本日:
管理者: Katsuhiro Suzuki(katsuhiro( a t )katsuster.net)
This is Simple Diary 1.0
Copyright(C) Katsuhiro Suzuki 2006-2023.
Powered by PHP 8.2.20.
using GD bundled (2.1.0 compatible)(png support.)