1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【Baochip】Dabao ボードのLチカ

1
Posted at

概要

NT金沢2026 1日目の夜に行われたBaochipハンズオンで時間内にLチカできなったが延長線の末出来たのでメモ。

大元

結果

環境

  • Windows 11 Pro 23H2
  • WSL2 Ubuntu 22.04
  • VS Code 1.118.1
  • Baochip Vesion 1.0.0 ※VS CodeのExtention
  • rustc 1.96.0 (ac68faa20 2026-05-25)

コード

apps-dabao/dabao-console/src/cmds/test.rs

に次のように書く。

helpstring のとこにも blink 書いてるので注意。

        let helpstring = "test [blink] [proc] [freemem] [interrupts] [panic] [env]";

        let mut tokens = args.split(' ');

        if let Some(sub_cmd) = tokens.next() {
            match sub_cmd {
                "blink" => {
                    use std::time::Duration;

                    use bao1x_api::{IoGpio, IoxDir, IoxHal, IoxPort, IoxValue};
                    let iox = IoxHal::new();
                    iox.set_gpio_pin_dir(IoxPort::PB, 4, IoxDir::Output);
                    loop {
                        iox.set_gpio_pin_value(IoxPort::PB, 4, IoxValue::High);
                        std::thread::sleep(Duration::from_secs(1));
                        iox.set_gpio_pin_value(IoxPort::PB, 4, IoxValue::Low);
                        std::thread::sleep(Duration::from_secs(1));
                    }
                }

ハマったところ

Rustのバージョン

1.90以上じゃなきゃダメと書いてったのでハンズオン当日朝に最新の1.96にしたはずが、なぜか1.86になっててビルド通らなかった。

Rustのビルドは時間かかる上にLet’s noteのバッテリー付きかけてたせいか処理も遅くてすごいことになった。

ビルドが長い

上でも書いたけどRustはビルドが長い。特に初回はフルビルドなので時間かかる。

20分とかかかったような。

Baochipの場所を認識しない

Dabaoを接続するとUSBメモリみたくBaochipの場所としてDドライブが認識されるんだけど、WSL側で /mnt/d で指定しようとするとうまく認識できなかったりした。

$ ls /mnt

d が見えててもうまく行かなかったりして、Dabaoのリセットボタン押してみたり

$ sudo mount -t drvfs D: /mnt/d

したりしたら認識した。

Baochipの拡張機能から Set baochip location で繋がるか確認するとよい。

e976dae2-700c-4b68-b878-a6db57ac47a8.pngimage.png

シリアルポートが認識しない

これが一番ハマった。

PowershellからWSLにCOMポートを渡す?必要があるっぽい。

Powershellを管理者権限で開いてusbipd-win をインストール。

>> winget install --interactive --exact dorssel.usbipd-win

インストールしたあと、ひとまずDabaoが見えるか確認

>> usbipd list

デバイスマネージャーとかで見たDabaoのCOMポートが出ているはず。
対象COMポートのBUS IDに対して

>> usbipd bind --force --busid 1-3
>> usbipd attach --wsl --busid 1-3

認識されているとWSL側で

$ python3 -m serial.tools.list_ports -v
/dev/ttyACM0        
    desc: Dabao
    hwid: USB VID:PID=1D50:6197 SER=WD2Z93 LOCATION=1-1:1.2
1 ports found

みたいに認識される。

Baochip拡張の set bootloader mode serial port とかでも選べるはず。

image.png

image 1.png

変な認識してるとattachがうまく行かないので

usbipd detach --busid 1-3
usbipd unbind --busid 1-3

とかリセットボタン押したりする。

あと「Baochipの場所を認識しない」といっしょにハマるとリセットボタン押すたびにやり直しになるので、先にBaochipの場所認識ができてから順にトライする。

Consoleに戸惑う

全部環境が整うとMonitorを押すとコンソールに入れる。
以下でEnterとか押すと[Console]って出てくる。

image 3.png

で、test blink って書いてEnterで動く。

image 4.png

が、この辺のUIで微妙なことがある。

Ctrl + C でキャンセルしてから Monitorしなおすとキー認識しなくなったり。

そのときはひとまずDabaoリセットして繋ぎ直すとうまくいく。

感想

光って嬉しい。

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?