Skip to main content

Programming Tool for CH32L, CH32V, and CH32X Microcontrollers with WCH-LinkE

Project description

Programming Tool for CH32L, CH32V, and CH32X Microcontrollers with WCH-LinkE

Description

With this tool, the WCH RISC-V microcontrollers CH32Lxxx, CH32Vxxx, and CH32Xxxx can be programmed with the WCH-LinkE (pay attention to the "E" in the name) via its serial debug interface.

Preparations

To use the WCH-Link on Linux, you need to grant access permissions beforehand by executing the following commands:

echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1a86", ATTR{idProduct}=="8010", MODE="666"' | sudo tee /etc/udev/rules.d/99-WCH-LinkE.rules
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1a86", ATTR{idProduct}=="8012", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-WCH-LinkE.rules
sudo udevadm control --reload-rules

On Windows, if you need to you can install the WinUSB driver over the WCH interface 1 using the Zadig tool.

Installation

Ensure that the prerequisites for installing Python packages are met. Then execute the following command in the command line:

pip install rvprog

Usage

To upload firmware, you should make the following connections to the WCH-LinkE (SWCLK is not present on the CH32V003 and therefore does not need to be connected):

WCH-LinkE       CH32V/X
+-------+      +-------+
|  SWCLK| ---> |SWCLK  |
|  SWDIO| <--> |SWDIO  |
|    GND| ---> |GND    |
|    3V3| ---> |VDD    |
+-------+      +-------+

If the blue LED on the WCH-LinkE remains illuminated once it is connected to the USB port, it means that the device is currently in ARM mode and must be switched to RISC-V mode initially. There are a few ways to accomplish this:

  • You can utilize the rvprog tool with the -v option (see below).
  • Alternatively, you can select "WCH-LinkRV" in the software provided by WCH, such as MounRiver Studio or WCH-LinkUtility.
  • Another option is to hold down the ModeS button on the device while plugging it into the USB port.

More information can be found in the WCH-Link User Manual.

Usage: rvprog [-h] [-a] [-v] [-b] [-u] [-l] [-e] [-G] [-R] [-f FLASH]

Optional arguments:
  -h, --help                show help message and exit
  -a, --armmode             switch WCH-LinkE to ARM mode
  -v, --rvmode              switch WCH-LinkE to RISC-V mode
  -b, --unbrick             unbrick chip (power cycle erase)
  -u, --unlock              unlock chip (remove read protection)
  -l, --lock                lock chip (set read protection)
  -e, --erase               perform a whole chip erase
  -G, --pingpio             make nRST pin a GPIO pin (CH32V003 only)
  -R, --pinreset            make nRST pin a reset pin (CH32V003 only)
  -f FLASH, --flash FLASH   write BIN file to flash

Example:
rvprog -f firmware.bin

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rvprog-1.6.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

rvprog-1.6.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file rvprog-1.6.0.tar.gz.

File metadata

  • Download URL: rvprog-1.6.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for rvprog-1.6.0.tar.gz
Algorithm Hash digest
SHA256 f1215c794df09a82349a6a33f3239c8fd28ef3385f49485d871c05b7ddf3ae96
MD5 f3548efe5c8dcfc349e6a0ff7a243605
BLAKE2b-256 e10d84df36ccfa24bd2509e820e984b23ffee0503aa6198cdc59dee637f09f5e

See more details on using hashes here.

File details

Details for the file rvprog-1.6.0-py3-none-any.whl.

File metadata

  • Download URL: rvprog-1.6.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for rvprog-1.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a1bb136109ef7cb4f64ae190118606e44eba60c714c81a9e61885128f429eb0
MD5 3fe946e00f8ee68e5112d2331b396de0
BLAKE2b-256 80c9dda337bb3118c6c02b5b79139ffd45a6fab9e1996f373a83fd33f2c79b0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page