« headless RaspberryPiインストール方法(v2) | トップページ | RaspberryPiにTinyGOをインストールする »

2020年10月20日 (火)

PlatformIOをRaspberryPi4で動かしてみる(実験)

2020/10/20
初版

PlatformIO on RaspberryPi4

PlatformIO on RaspberryPi4

概要

PlatformIOをRaspberryPi4で動かしてみる(実験)。
ターゲットとして、XIAO、M5Atom、Wio-Terminalで、ビルド書き込みを行ってみた。

開発ツールplatformioのRaspberryPiのインストールについてはlinuxでPCのものと同じなので以下を参照のこと:
開発ツールPlatformIOをcliで使う(Seeeduino-XIAO版)
M5Atomを開発ツールPlatformIOで使う(M5Atom/Arduino版)
開発ツールPlatformIOをcli(comand line interface)で使う(v2:Seeeduino-Wio-Terminal/Arduino版)

結果

M5Atomは、問題なく、ビルド書き込みを完了したが tool-bossacを書き込みツールとして利用しているXIAO、Wio-Terminalについては 書き込み終了後、以下のようなエラーを出力して、OS自身が止まってしまい、電源を落としての再起動が必要となる。

<省略> [============================ ] 96% (24/25 pages) [==============================] 100% (25/25 pages) Verify successful Done in 0.085 seconds Message from syslogd@rpi4RED at Oct 20 08:40:11 ... kernel:[25018.731567] Internal error: Oops: 206 [#1] SMP ARM Message from syslogd@rpi4RED at Oct 20 08:40:11 ... kernel:[25018.731842] Process kworker/0:2 (pid: 2233, stack limit = 0xc11d8904) <省略>

書き込み自身は完了しているようだ。

platformio.ini

使用したplatformio.iniは、PCのものと同じだが、RaspberryPi4の場合、/dev/ttyANAが (たぶん)コンソール用に存在しているので、upload_portを明記する必要がある。
XIAO用:

; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html [env:seeed_xiao] platform = atmelsam board = seeed_xiao framework = arduino build_flags = -DXIAO upload_protocol = sam-ba upload_port = /dev/ttyACM0 monitor_speed = 115200 lib_ldf_mode = deep+

M5Atom用:

; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html [env:m5stick-c] platform = espressif32 board = m5stick-c framework = arduino build_flags = -DM5ATOM upload_port = /dev/ttyUSB0 monitor_speed = 115200 lib_deps = # use M5Atom lib 3113 # use "FastLED" 126 # Accept new functionality in a backwards compatible manner and patches adafruit/Adafruit NeoPixel @ ^1.6.0 lib_ldf_mode = deep+

Wio-Terminal用:

; PlatformIO Project Configuration File ; ; Build options: build flags, source filter ; Upload options: custom upload port, speed and extra flags ; Library options: dependencies, extra library storages ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples ; https://docs.platformio.org/page/projectconf.html [env:seeed_wio_terminal] platform = atmelsam board = seeed_wio_terminal framework = arduino build_flags = -DWIO_TERMINAL upload_protocol = sam-ba upload_port = /dev/ttyACM0 monitor_speed = 115200 lib_ldf_mode = deep+

使用したスケッチ

src/main.ino

#ifdef M5ATOM #include "M5Atom.h" #endif #ifdef M5ATOM #define LED_BUILTIN 21 #endif // the setup function runs once when you press reset or power the board void setup() { // initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW delay(100); // wait for a second }

ビルド・実行

以下の手順でビルド・実行する:
(platformio.iniは、ボードごとに切り替える)

run pio -t upload

参考情報

headless RaspberryPiインストール方法(v2)

XIAO/M5Atomで気圧センサー(HP206C)を動かす(XIAO/Arduino版、M5Atom/Arduino版)
XIAO/M5AtomでLCD240x240(SPI)を制御する((XIAO/Arduino版、M5Atom/Arduino版)

M5AtomでOLED128x128(SPI)を制御する(Arduino版)
XIAOでOLED128x128(SPI)を制御する(Arduino版)
XIAOでLCD160x80(SPI)を制御する(Arduino版)

以上

|

« headless RaspberryPiインストール方法(v2) | トップページ | RaspberryPiにTinyGOをインストールする »

linux」カテゴリの記事

PlatformIO」カテゴリの記事

Arduino」カテゴリの記事

コメント

この記事へのコメントは終了しました。