Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PCとPicoRuby-ESP32間でシリアルファイル転送
Search
Katsuhiko Kageyama
December 04, 2025
Technology
57
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PCとPicoRuby-ESP32間でシリアルファイル転送
Katsuhiko Kageyama
December 04, 2025
More Decks by Katsuhiko Kageyama
See All by Katsuhiko Kageyama
同人誌とVMづくり
kishima
1
55
Tab5をRubyで動くパソコンにする
kishima
2
410
Family mrubyの進捗
kishima
1
130
PicoRuby as a Multi-VM Operating System
kishima
1
480
M5UnifiedとPicoRubyで楽しむM5シリーズ
kishima
0
570
Rubyでmicro-ROS!
kishima
0
190
mruby(PicoRuby)で ファミコン音楽を奏でる2
kishima
1
230
mruby(PicoRuby)で ファミコン音楽を奏でる
kishima
2
820
PicoRuby/R2P2で自分だけのコンピュータを作ろう
kishima
1
680
Other Decks in Technology
See All in Technology
リアーキテクチャ後の障害ゼロを目指したShadow Testingの取り組み
nihonbuson
PRO
1
180
白金鉱業Meetup Vol.25 アウトカムが二値のデータに対するCausal Impact
brainpadpr
0
300
What the customer really needed
kawaguti
PRO
3
220
PQC移行の今 -- IETF からみた現在地
satokan
3
190
バイブコーディング時代のWebアプリ開発入門~Cloud Runで学ぶセキュアなビルドとデプロイ
waiwai2111
1
150
Railsのように考える: See through the Master
snoozer05
PRO
5
1.3k
絵ではじめるKubernetesセキュリティ
aoi1
5
710
「ピッケル本」日本語版は4.0(第6版)が出版されるべき / pickaxe4-nagoyark05
kakutani
2
290
Azure Serverless 2026:Production-ready な AI エージェント基盤 / Azure Serverless 2026: Production-Ready AI Agent Platform
miyake
2
590
時うどん〜Socket.getifaddrsで学ぶネットワーク編 / Tokiudon: The Socket.getifaddrs Edition
coe401_
4
260
AIに任せた品質は、誰が見立てるのか - AI時代のテストマネジメント
nakanao
3
3k
人にやさしく、AIにやさしく、書き手を選ばないIaCのガードレール再考 / Rethinking IaC Guardrails for Humans and AI Alike
kohbis
5
960
Featured
See All Featured
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.3k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
250
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
600
Building AI with AI
inesmontani
PRO
1
1.2k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
340
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
Navigating Team Friction
lara
192
16k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
550
Faster Mobile Websites
deanohume
310
32k
Claude Code のすすめ
schroneko
67
230k
Leo the Paperboy
mayatellez
10
2.3k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Transcript
PCとPicoRuby-ESP32間で シリアルファイル転送 @kishima
自己紹介 @kishima 組み込み系エンジニア マネージャ業 mruby好き 電子工作好き 最近はFamily mruby OSと いう趣味プロジェクトにご熱
心
ふつうのマイコンソフト開発 1. 実行したいアプリケーションをビルドする a. マイコンのOSも含めた一つのバイナリが生成される 2. ビルドした実行バイナリをシリアル通信やデバッガを使ってマイコンの FROM へ転送 a.
ファイルシステムがないので、マイコンの OSも含めてまるごと転送 3. マイコンをリセットして、アプリを起動 4. 動作確認 5. 1に戻る
PicoRubyのすごいところ FilesystemとMSC実装あり USBでつなぐと、USBスト レージとして見える Raspi Pico
ESP32版だとMSCできない USBストレージとして見せ ることができない ESP32 device
MSCが使えないなら CDCを使えばいいじゃない ESP32 device
独自のプロトコル 以下のポリシー • PCからのコマンドに対して、ESP32側が応答する • パケットは、CRC32でエラーチェック ◦ USBシリアル通信は簡単に化けるので必須 • パケット区切りはCOBSを使う
• 長いデータはチャンクで送る • チャンク単位で再送する(未実装) • ファイル操作系コマンドはJSONで表現
パケット形式 LENGTHはJSONかBinaryDataの長さを示しています では、パケットの全長はどうやって判定するのか?
COBS(Consistent Overhead Byte Stuffing) 0x00 を区切りバイトとして、扱えるようになる仕組み 0x00 が本文中に現れたら、その位置までのバイト長を OverheadByteとして挿入する 読み出すとき、0x00が来るまで読み続ければ良いので、実装が楽になる
オーバヘッドも少ない 0x00がロストしても、0x00を待ち続ければ復帰できる (パケット長を読んでから、 Bodyを読む形にした場合、パケット長が化けると大変) https://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing
CMD
“PUT” command JSONの後に実際のバイナリデータが続く offで、チャンクが書き込まれるべきファイル位置を指定 0バイトデータ送信で、チャンク終わりを表現
“LS” command: Response
実際にデモ
ファイル転送(ローカルの test.rbを転送)
結果
制約 USBシリアル通信を占有するので、PC側のターミナルとのシリアル通信と競合する 片方しか使えないので、モードを切り替える仕組みが必要 たとえば・・・ 起動時に所定のボタンが押されていればファイル転送モードに入る
今後の課題 デスクトップのファイルエクスプローラーからも見えるようにしたい FUSEを使えばいけそう Filesystem on Userspace https://ja.wikipedia.org/wiki/Filesystem_in_Userspace