wch-isp(1)
π wch-isp β like, the manual page, bestie πΈ
okay so you found yourself at wch-isp(1) β welcome to the group chat π«Ά this is the firmware programmer for WCH microcontrollers, and by the end of this page you're gonna understand it so well. no cap.
β¨ SYNOPSIS β¨
like, here's the whole vibe in code form (copy it exactly, don't @ me):
wch-isp [OPTIONS] COMMAND [ARG...]
wch-isp [-VDnpr] [-d UID] [flash|write|verify|reset] FILE
wch-isp [-VDnpr] [-d UID] [erase|config|remove-wp]
wch-isp [-VDnpr] [-d UID] config-set REG_NAME[:FIELD_SEL]=VALUE
wch-isp [-VDnpr] [-d UID] [list]
see how it's always OPTIONS first, then a COMMAND, then whatever args that command wants? that's the whole pattern, iykyk π«
π DESCRIPTION π
wch-isp is an utility to write firmware into the flash of WCH microcontrollers, over USB. that's the main character energy right there π
and here's the little detail that's genuinely so thoughtful: by default the flash content is verified after writing. like, it double-checks its own work. we love a self-aware icon π
π OPTIONS π
every single flag, no skips, fr fr:
-d UIDβ selects the USB device that matches the UID. and if nothing matches? then UID is used as an index to select a device from the list. cute little fallback, honestly π-nβ do not verify flash content after writing. heads up: verification is done by default, so this one turns it off π-pβ prints a progress bar during command operation. the little[####]bar. obsessed π-rβ reset the microcontroller after the command is completed π-Dβ enable debug information, print raw isp commands sent over USB. for when you wanna see everything the chip is saying, lowkey nosy but valid π-Vβ prints version information to stdout, then exits. bye bestie π
π COMMANDS π
list
lists the currently detected compatible USB devices πβ¨
write FILE
writes FILE into flash β and it will automatically erase sufficient flash sectors before writing to it. yes queen, it handles the boring part for you π
flash FILE
writes FILE into flash, same as write. literally the same thing. twins π―
verify FILE
verifies FILE content against the flash content. a lil vibe check for your firmware β
reset
resets the microcontroller and jumps to code flash π
erase
erases all the flash content. all of it. no survivors π (ok but seriously, it's all of it)
config
prints a memory dump of the chip configuration. and when supported, the config is decoded to show registers name with it's fields value β so you get the pretty human-readable version, not just bytes πΈ
config-set REG_NAME[:FIELD_SEL]=VALUE
changes the value of a config field π οΈ
REG_NAME designates the name of the register to modify in the config (see config output, bestie β it's right there). FIELD_SEL is optional, and can be either:
- a number
[0-9]+ - a range
[0-9]+:[0-9]+ - or the name of a field
three whole options, we stay versatile π
remove-wp
disables flash write protection β heads up though, this modifies the chip configuration π«Ά
π¦ EXAMPLES π¦
list detected devices:
$ wch-isp list
0: BTVER v2.7 UID 8d-ff-ba-e4-c2-84-09-69 [0x1069] CH569
1: BTVER v2.5 UID f2-3e-88-26-3b-38-b5-9d [0x1980] CH32V208WBU6
look at those two icons sitting there being detected πβ¨
flash the firmware.bin file, -p enables the progress bar:
$ wch-isp -p flash firmware.bin
BTVER v2.5 UID f2-3e-88-26-3b-38-b5-9d [0x1980] CH32V208WBU6
[####################################################] write 35392/35392
[####################################################] verify 35392/35392
flash done
not the double progress bar π write and verify, both ate π―
erase the device's flash, select the device by it's UID (option -d):
$ wch-isp -d f2-3e-88-26-3b-38-b5-9d erase
BTVER v2.5 UID f2-3e-88-26-3b-38-b5-9d [0x1980] CH32V208WBU6
erase done
picking your device by UID is so much more precise than an index, ngl π―
change the config to disable the read protection RDPR and change the STOP_RST bit:
$ wch-isp config-set RDPR=0xa5 USER:STOP_RST=0
BTVER v2.6 UID cd-ab-bb-76-04-bc-8c-de [0x153f] CH32V103x6x6 (flash 32K)
writing new config
config-set done
$ wch-isp config
BTVER v2.6 UID cd-ab-bb-76-04-bc-8c-de [0x153f] CH32V103x6x6 (flash 32K)
raw: a5 5a ff 00 ff ff ff ff ff ff ff ff
00: RDPR: 0xa5
[7:0]: 0xa5 (disabled)
02: USER: 0xff
[5] PORCTR: 1 (0b1)
[2] STANDBY_RST: 1 (disabled)
[1] STOP_RST: 0 (enabled)
[0] IWDG_SW: 1 (disabled)
04: DATA0: 0xff
06: DATA1: 0xff
08: WRPR0: 0xff
09: WRPR1: 0xff
0a: WRPR2: 0xff
0b: WRPR3: 0xff
config done
see how config-set takes REG_NAME:FIELD_SEL=VALUE and then config shows you the whole decoded dump after? the way that it just works π₯ and yes, RDPR went to 0xa5 (disabled) and STOP_RST flipped to 0 (enabled). you did that π
lil reminder bestie:remove-wpandconfig-setboth modify the chip configuration. like, actually change stuff on the chip. so know what you're doing before you type it, mwah π«Ά
and that's the whole page!! version 0.5.0, dated 1980-01-01 β yes the date is iconic and weird, we stan an ageless legend πβ¨ go flash something, you got this π
π¦ where this page comes from
- nixpkgs unstable: wch-isp 0.5.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms