Skip to content

An open sourced python tool for flashing WCH CH55x series USB microcontroller with bootloader v2.30, v2.31 & v2.40.

License

Notifications You must be signed in to change notification settings

Pe3ucTop/ch552tool

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ch55xtool

Now available on pypi!

An open sourced python command line flash tool for flashing WinChipHead CH55x series 8051 USB micro controllers, including CH551, CH552, CH553, CH554, and CH559 with bootloader version(BTV) 2.30, 2.31, v2.40. (You can check the verision by using the official CH55x Tool.)

Usage

  • -f <filename> Erase the whole chip, and flash the bin file to the CH55x.
  • -r Issue reset and run after the flashing.
python3 -m ch55xtool -f THE_BINARY_FILE.bin

Tool Setup

  • Linux Distros

    Most Linux distros come with libusb, so you only need to install the pyusb packge.

python3 -mpip install ch55xtool
  • Mac OS

For Mac OS, you need to install both libusb and pyusb.

# If you dont have brew installed.
# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install libusb
python3 -mpip install ch55xtool
  • As for Windows, oh no... :(
    1. First, you need to download the Zadig for replacing the CH375 driver from WCH to libusb.
    2. Click the Options->List all devices, to show all devices
    3. Find the device marked with USB Module, which presented driver is CH375_balabala
    4. Replace the driver with libusb-win32.
    5. Install the pyusb package.
python3 -mpip install ch55xtool #Make sure you have the python3 in the PATH, not python2
  1. If you want to use the WCH Toolchain, open the device manager, find the device marked with libusb-win32 deives, right clicked on it, uninstall the driver and delete the driver. You can also check the FAQ of Zadig HERE.

FAQ

  • Why I got a Error: No backend available ?

On windows, this means you dont a valid libusb device, see the guide above. For other system, you might dont have the libusb installed, follow the guide above.

  • Why it said NO_DEV_FOUND ?

Pyusb unable to fine the device with given PID&VID. Maybe you dont power on your device, or it is not in DFU mode.

  • I got a USB_ERROR_CANNOT_SET_CONFIG error.

This high probability is a permission issue. Add SUBSYSTEM=="usb", ATTRS{idVendor}=="4348", MODE="0666" to /etc/udev/rules.d/50-ch55x.rules, and re-plug your device. Otherwise you need sudo.

  • I got a USB_ERROR_CANNOT_DETACH_KERNEL_DRIVER, or USB_ERROR_CANNOT_CLAIM_INTERFACE error.

I never met with those problems on a working CH552. Checking the power, the previliage, and praying may help.

  • What if it return Bootloader version not supported?

The program dont support BTVER lower than 2.30(welcome PR, but since they are too old, I dont have plan to support them). Or maybe they have a newer verison, for this situlation, it is welcome for you to open an issue.

About

An open sourced python tool for flashing WCH CH55x series USB microcontroller with bootloader v2.30, v2.31 & v2.40.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%