ch32-rs/wlink
ch32-rs/wlink has 359 GitHub stars and 60 forks. GitHot measured +3 stars in 24 hours. Last checked 2026-11-18 01:47 UTC. Last push 2026-11-12.
Measured star growth
- in 24h
- +3
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
About
An open source WCH-Link library/command line tool written in Rust.
Developer ToolsREADME.md
Originalwlink - WCH-Link(RV) command line tool
Note This tool is still in development and not ready for production use.
Feature Support
- Flash firmware, support Intel HEX, ELF and raw binary format
- Erase chip
- Halt, resume, reset support
- Read chip info
- Read chip memory(flash)
- Read/write chip register - very handy for debugging
- Code-Protect & Code-Unprotect for supported chips
- Enable or Disable 3.3V, 5V output
- SDI print support, requires 2.10+ firmware
- Serial port watching for a smooth development experience
- Windows native driver support (WCHLinkDrv), no WinUSB/libusb driver needed; works on x86, x64 and ARM64 (nightly builds currently ship x86/x64 Windows binaries, so build from source on ARM64)
Tested On
Probes
Current firmware version: 2.15 (aka. v35).
NOTE: If you are using newer chips like CH32V317 or CH585, be sure to use the latest firmware.
NOTE: The firmware version is not the same as the version shown by WCH's toolchain. Because WCH calculates the version number by
major * 10 + minor, so the firmware version 2.10 is actually v300x020a.
- WCH-Link CH549 - the first version, reflash required when switching mode
- WCH-LinkE CH32V305 - the recommended debug probe
- WCH-LinkW CH32V208 - wireless version
- WCH-Link? CH32V203
MCU
Note A common misunderstanding is that the CH32V2 and CH32V3 series has fewer flash! No it's not. The CH32V203 series has 224K available flash. The CH32V208 and CH32V30x series has 480K available flash. The number in the datasheet is the "zero-wait-state" flash size, which is not the same as the "available" flash size.
- CH32V003
- CH32V103
- CH32V203/CH32V208
- CH32V307
- CH569/CH565
- CH573/CH571
- CH583/CH582/CH581
- CH585/CH584
- CH592/CH591
- CH643
- CH32V317 - I don't have this chip, help wanted
- CH641
- CH32X035/CH32X033
- CH32L103/CH32M103
- CH32H417
- CH570/CH572
- CH586/CH587
- CH32M030
- CH32V205/CH32V203(QingKe V3B) - the new-generation CH32V205/CH32V203 family (USB2.0 HS), unrelated to the older CH32V203. Requires WCH-LinkE firmware v3.6+ (older builds spell it
2.22); older firmware misdetects it as CH32V20X with garbage ChipID/ESIG - CH32V407
- CH32V467
- CH32X315/CH32X305
- CH8571 - No other source about this chip, help wanted
- ... (Feel free to open an issue if you have tested on other chips)
Install
cargo install --git https://github.com/ch32-rs/wlink or download a binary from the Nightly Release page.
Linux
Note On Linux, you should install libudev and libusb development lib first. Like
sudo apt install libudev-dev libusb-1.0-0-devon Ubuntu.
Arch Linux
Arch Linux users can install wlink-git via the AUR.
yay -Syu wlink
Windows drivers
On Windows, wlink tries these backends in order and uses the first one that can open the probe:
- the legacy
WCHLinkDLL.dll/ CH375 driver — 32-bit builds only; - WCH's native driver (
WCHLinkDrv/WCHLinkW64.SYS, installed by WCH's WCH-Link tooling) — 64-bit Windows (x64 and ARM64). The backend also compiles for x86, but WCH ships no 32-bit build of that driver; - WinUSB via Zadig (nusb/libusb) — all platforms.
A probe is bound to one driver for I/O. nusb can still enumerate a probe
bound to WCH's native driver (and report its USB serial number), but it cannot
open that interface — only the native driver can. Serial selectors
(-d 1a86:8010:<SERIAL>) therefore require WinUSB; with the native or CH375
driver use -d <INDEX> instead. wlink says so when a serial fails to open, and
-d <SERIAL> never silently falls back to an index.
See the USB transport reference for the native driver's IOCTL layout.
Usage
Note For help of wire connection for specific chips, please refer to
docssubdirectory.
Selecting a probe
-d picks which WCH-Link to use. Without it wlink takes the first one it
enumerates, which is not deterministic when several probes are attached, or
when one of them is in DAP mode. Because that could modify the wrong board,
write-like commands (flash, erase, unprotect, protect, write-reg,
write-mem, reset, halt, resume, set-power, sdi-print,
mode-switch) refuse to run when more than one probe is attached and no -d
was given (probes in both RV and DAP mode are counted). Read-only commands
such as status, regs, dump and list keep the first-probe behaviour.
The error lists every RV-mode probe with a -d selector that can be copied
into the command:
> wlink flash firmware.bin
Error: 3 WCH-Link probes attached; refusing to continue without an explicit probe.
Select one of the following with `-d` (a serial stays stable across replugs when available; `wlink list` shows details):
-d 1a86:8010:7E238F0602BE # WCH-Link#0 (RV mode)
-d 1a86:8010:F93D8F067E10 # WCH-Link#1 (RV mode)
-d 1a86:8010:D7708F065C7F # WCH-Link#2 (RV mode)
> wlink -d 1a86:8010:D7708F065C7F flash firmware.bin
A probe in DAP mode still counts toward the check, but cannot be used: it is
listed separately with the command to switch it back to RV mode first,
wlink -d 1a86:8012:<SERIAL> mode-switch --rv.
When a probe does not expose a USB serial number, or is reachable through an
index-only Windows driver (CH375 on 32-bit, or WCH's native WCHLinkDrv), the
error offers -d <INDEX> instead and keeps the serial in the description to
help identify the probe. The index is resolved by the backend that actually
opens the probe, whose enumeration order need not match nusb's, so the serial
shown beside it is a hint rather than a guarantee. Indices also change when a
probe is replugged or switches mode, so prefer the serial form when it is
offered.
A serial names one probe reliably:
> wlink list
<WCH-Link#0 nusb device> ID 1a86:8010 Serial F93D8F067E10 (USB-FS 12 Mbps) (RV mode)
<WCH-Link#1 nusb device> ID 1a86:8010 Serial D7708F065C7F (USB-FS 12 Mbps) (RV mode)
> wlink -d 1a86:8010:D7708F065C7F status
> wlink -d D7708F065C7F status # serial alone works too
The VID:PID:SERIAL form is the same string probe-rs accepts in
PROBE_RS_PROBE, so a serial copied from probe-rs list works unchanged. The
IDs are accepted for compatibility; wlink still searches its own known VID/PID
pairs, which lets one serial select the probe in either RV or DAP mode. A plain
number keeps the original index behaviour.
> # Flash firmware.bin to Code FLASH at address 0x08000000
> wlink flash --address 0x08000000 ./firmware.bin
12:10:26 [INFO] WCH-Link v2.10 (WCH-Link-CH549)
12:10:26 [INFO] Attached chip: CH32V30X(0x30700518)
12:10:26 [INFO] Flashing 8068 bytes to 0x08000000
12:10:27 [INFO] Flash done
12:10:28 [INFO] Now reset...
12:10:28 [INFO] Resume executing...
> # Flash firmware.bin to System FLASH, enable SDI print, then watch serial port
> wlink flash --enable-sdi-print --watch-serial firmware.bin
02:54:34 [INFO] WCH-Link v2.11 (WCH-LinkE-CH32V305)
02:54:34 [INFO] Attached chip: CH32V003 [CH32V003F4P6] (ChipID: 0x00300500)
02:54:34 [INFO] Flash already unprotected
02:54:34 [INFO] Flash protected: false
02:54:35 [INFO] Flash done
02:54:35 [INFO] Now reset...
02:54:35 [INFO] Now connect to the WCH-Link serial port to read SDI print
Hello world from ch32v003 SDI print!
led toggle
led toggle
...
> # Dump Code FLASH, for verification
> # use `-v` or `-vv` for more logs
> wlink -v dump 0x08000000 100
18:31:18 [DEBUG] (1) wlink::device: Acquired libusb context.
18:31:18 [DEBUG] (1) wlink::device: Claimed interface 0 of USB device.
18:31:18 [INFO] WCH-Link v2.8 (WCH-LinkE-CH32V305)
18:31:18 [DEBUG] (1) wlink::operations: attached chip: ChipInfo { chip_family: CH32V20X, chip_type: "0x20360510" }
18:31:18 [DEBUG] (1) wlink::operations: Chip UID: cd-ab-b4-ae-45-bc-c6-16
18:31:18 [DEBUG] (1) wlink::operations: flash protected: false
18:31:18 [DEBUG] (1) wlink::operations: SRAM CODE mode: 3
18:31:18 [DEBUG] (1) wlink::operations: RISC-V core version: Some("WCH-V4B")
18:31:18 [INFO] Read memory from 0x08000000 to 0x08000064
08000000: b7 00 00 08 67 80 80 00 73 50 40 30 73 50 40 34 ×00•g××0sP@0sP@4
08000010: 81 40 01 41 81 41 01 42 81 42 01 43 81 43 01 44 ×@•A×A•B×B•C×C•D
08000020: 81 44 81 46 01 47 81 47 01 48 81 48 01 49 81 49 ×D×F•G×G•H×H•I×I
08000030: 01 4a 81 4a 01 4b 81 4b 01 4c 81 4c 01 4d 81 4d •J×J•K×K•L×L•M×M
08000040: 01 4e 81 4e 01 4f 81 4f 97 01 00 18 93 81 81 7b •N×N•O×Oו0•×××{
08000050: f3 23 40 f1 b7 02 00 00 93 82 02 00 63 f4 72 00 ×#@×ו00×ו0c×r0
08000060: 6f 00 c0 29 o0×)
> # Dump System FLASH, BOOT_28KB
> wlink dump 0x1FFF8000 0x7000
....
> # Dump all general purpose registers
> wlink regs
16:24:20 [INFO] Dump GPRs
dpc(pc): 0x2000011a
x0 zero: 0x00000000
x1 ra: 0x49c85c07
x2 sp: 0x20002800
x3 gp: 0x206e24c4
x4 tp: 0x9add07a3
x5 t0: 0xb4a9b38a
....
> # Set dpc(pc) to System Flash
> wlink write-reg 0x7b1 0x000009a8
Documentation
- WCH-LinkRV protocol reference — frame format, command tables, operation flows and constants, rebuilt from the source code. Also published at https://ch32-rs.github.io/wlink/ once GitHub Pages is enabled (built with mdBook from
docs/). - Chip wiring and part-number notes — see the
docs/subdirectory for per-family connection guides.
References
- docs/references.md
- WCH's openocd fork: https://github.com/treideme/openocd-hacks
License
This project is licensed under the MIT or Apache-2.0 license, at your option.