Skip to main content

USB Programming Tool for WCH Microcontrollers

Description

With this tool, almost all WCH microcontrollers (CH5xx, CH6xx, CH32Fxxx, CH32Vxxx, CH32Xxxx, and CH32Lxxx) which have a factory-builtin bootloader (v2.x.x) can be flashed via USB.

Supported microcontrollers: CH54x, CH55x, CH56x, CH57x, CH58x (incl. CH584/CH585), CH59x, CH643, CH32F103, CH32F20x, CH32V103, CH32V20x, CH32V30x, CH32V317, CH32X03x and CH32L103. Microcontrollers without a USB bootloader (e.g. CH32V00x) are not supported; use rvprog with a WCH-LinkE for them.

Preparations

On Linux you do not need to install a driver for the USB bootloader. However, by default Linux will not expose enough permission to upload your code. In order to fix this, open a terminal and run the following commands:

echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="4348", ATTR{idProduct}=="55e0", MODE="666"' | sudo tee /etc/udev/rules.d/99-ch55x.rules
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="1a86", ATTR{idProduct}=="55e0", MODE="666"' | sudo tee -a /etc/udev/rules.d/99-ch55x.rules
sudo udevadm control --reload-rules

For Windows, you need the CH372 driver. Alternatively, you can also use the Zadig tool to install the correct driver. Here, click "Options" -> "List All Devices" and select the USB module. Then install the libusb-win32 driver. To do this, the board must be connected and the microcontroller must be in bootloader mode.

Installation

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

pip install chprog

Usage

The bootloader must be started manually for new uploads. To do this, the board must first be disconnected from the USB port and all voltage sources. Now press the BOOT button and keep it pressed while reconnecting the board to the USB port of your PC. The chip now starts in bootloader mode, the BOOT button can be released and new firmware can be uploaded via USB. Alternatively, you can leave the board connected to the USB port, press and hold the BOOT button, press and release the RESET button and then release the BOOT button to enter the bootloader mode. If there is no BOOT button on the board, look at the datasheet to find out which pin needs to be pulled to which voltage level for the microcontroller to go into boot mode.

Now run the following command (example):

chprog firmware.bin

Run chprog without arguments to show the chip, its flash size, UID and configuration bytes. The chip stays in bootloader mode.

Metadata

Release files for chprog 2.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chprog 2.7.0
File Size Uploaded Provenance Actions
chprog-2.7.0.tar.gz 9.2 kB Without provenance Details for chprog-2.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chprog 2.7.0
File Interpreter ABI Platform Actions
chprog-2.7.0-py3-none-any.whl Python 3 none any Details for chprog-2.7.0-py3-none-any.whl

Total release size: 17.4 kB

Release files / chprog-2.7.0.tar.gz

Download URL chprog-2.7.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
53a8e106189d384bc5e20ef095a08b0a8ea50c819bde3f76a09cfade39ed8fa4
BLAKE2b-256 checksum
How to use checksums
eb503db98c77c2dd25f48a48653c3fe4e1fe9e079be49f16606dbaca14927227
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / chprog-2.7.0-py3-none-any.whl

Download URL chprog-2.7.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
22a967dddc6ee5c598d61e0f87311a576faffaa8bdd349c083be1b0ad5314eb3
BLAKE2b-256 checksum
How to use checksums
18f771ded75132e1618e1efcdd2c9437e0dae4484a3a894506247fa6b90a54db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for chprog 2.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page