Skip to main content

USB Programming Tool for WCH Microcontrollers

Project description

chprog - 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.

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

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

chprog-2.5.0.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

chprog-2.5.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file chprog-2.5.0.tar.gz.

File metadata

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

File hashes

Hashes for chprog-2.5.0.tar.gz
Algorithm Hash digest
SHA256 5849894856ce9f3645ae837b069dc7c6f89d1eea7f78da899f8f0cb6cbf5c08e
MD5 85c597dffa304571fb75b9ec7123392e
BLAKE2b-256 ea7971b58c18c935a69dcc0b4bcc2c72918dc115d1acdf10002ff91250a6f423

See more details on using hashes here.

File details

Details for the file chprog-2.5.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for chprog-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76eb8e8b1def454cf264389dfca5e7b11056a9e30b748ccbf0a4a7b16c7662a1
MD5 5d454c6f42b7b4a42ae38155385126f4
BLAKE2b-256 cd77b5dd2dcb1c7bdf3c82b81ac75f5e41a3d860c3f4296c4e1028b2d071f527

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