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

環境

  • Ubuntu 22.04 LTS

設定

を読んで、準備を以下のようにしておきます。

$ sudo apt install libusb-1.0-0-dev

udev の設定をしておきます。

$ sudo vim /etc/udev/rules.d/50-wchisp.rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="4348", ATTRS{idProduct}=="55e0", MODE="0666"

cargo 経由のインストールはNG

$ sudo apt install cargo

として、以下のようにインストールしようとしましたがディストリビューションパッケージの cargo ではうまくいかないようです。

$ cargo install wchisp --git https://github.com/ch32-rs/wchisp
    Updating git repository `https://github.com/ch32-rs/wchisp`
error: failed to parse manifest at `/home/owner/.cargo/git/checkouts/wchisp-052209e38cd65ae2/cefd870/Cargo.toml`

Caused by:
  feature `edition2024` is required

  The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.75.0).
  Consider trying a more recent nightly release.
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

バイナリをダウンロード

ビルド済みバイナリがナイトリーリリースとして用意されています。
以下から wchisp-linux-x64.tar.gz をダウンロードします。
https://github.com/ch32-rs/wchisp/releases/tag/nightly

解凍後、

$ cd wchisp-linux-x64/
$ chmod +x wchisp

動作確認

CG32V203ボードを BOOT0 モードにして USB でつないで

$ ./wchisp probe
08:25:15 [INFO] Found 1 USB device
08:25:15 [INFO] Opening USB device #0
08:25:15 [INFO] 	Device #0: CH32V203C8T6[0x3119]
08:25:15 [INFO] hint: use `wchisp info` to check chip info

認識しているようですね。しかしながら

$ ./wchisp info
08:25:24 [INFO] Opening USB device #0
Error: Operation timed out
$ ./wchisp config
08:25:44 [INFO] Opening USB device #0
Error: Operation timed out

あれれーと思って接続し直しました。

$ ./wchisp info
08:27:32 [INFO] Opening USB device #0
08:27:32 [INFO] Chip: CH32V203C8T6[0x3119] (Code Flash: 64KiB)
08:27:32 [INFO] Chip UID: CD-AB-B2-61-0E-BC-8D-C9
08:27:32 [INFO] BTVER(bootloader ver): 02.70
08:27:32 [INFO] Code Flash protected: false
08:27:32 [INFO] Current config registers: a55aff0000ff00ffffffffff00020700cdabb2610ebc8dc9
RDPR_USER: 0x00FF5AA5
  [7:0]   RDPR 0xA5 (0b10100101)
    `- Unprotected
  [16:16] IWDG_SW 0x1 (0b1)
    `- IWDG enabled by the software, and disabled by hardware
  [17:17] STOP_RST 0x1 (0b1)
    `- Disable
  [18:18] STANDBY_RST 0x1 (0b1)
    `- Disable, entering standby-mode without RST
  [23:22] SRAM_CODE_MODE 0x3 (0b11)
    `- CODE-228KB + RAM-32KB / CODE-160KB + RAM-32KB depending on the chip
DATA: 0xFF00FF00
  [7:0]   DATA0 0x0 (0b0)
  [23:16] DATA1 0x0 (0b0)
WRP: 0xFFFFFFFF
  `- Unprotected
179

Boot0モードは時間切れがあるようです。

インストール

動作に問題がないのでインストールします。

$ sudo cp wchisp /usr/local/bin
0
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
0
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?