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

Metadata

Release files for chprog 2.6.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.6.0
File Size Uploaded Provenance Actions
chprog-2.6.0.tar.gz 10.3 kB Without provenance Details for chprog-2.6.0.tar.gz

Built distribution (wheel)

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

Total release size: 19.7 kB

Release files / chprog-2.6.0.tar.gz

Download URL chprog-2.6.0.tar.gz
Size 10.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a17e09a19844b034165d1de88daae73622d84fc1a60a1b9cc4c1616d7a392472
BLAKE2b-256 checksum
How to use checksums
b14108656646e50663fb1d1841635601f4ac48fee3893aa471d78b562ebe343d
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.6.0-py3-none-any.whl

Download URL chprog-2.6.0-py3-none-any.whl
Size 9.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d693df226bcbc75eda59dff1ae648852e58da77efa3ca3ffdf6b445df601921
BLAKE2b-256 checksum
How to use checksums
ce142c3b06628381cc74d20755b108c105e6b17c324040f7a062340bab07c5c7
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.6.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