tillitis-key/hw/usb_interface/ch552_fw
Daniel Jobson f0c6016a6e ch552: add zero length packet handling
Terminate all 64-byte frames with a zero-length packet. Handle incoming
zero-byte frames by ignoring them. This fix addresses issues related to
transfers of an exact length of 64 bytes (or multiples thereof) on all
platforms. For simplicity, all 64-byte frames are terminated, regardless
of whether they are the last or not.
2025-11-13 11:38:47 +01:00
..
inc ch552: Make CTS active low, as per the standard 2025-10-28 08:40:06 +01:00
LICENSES Change license to BSD-2-Clause 2025-10-30 13:07:59 +01:00
src ch552: add zero length packet handling 2025-11-13 11:38:47 +01:00
.gitignore USB: move firmware for usb-to-serial MCU (CH552) 2024-06-25 15:47:22 +02:00
encode_usb_strings.py Follow REUSE specification 2025-10-30 13:07:59 +01:00
inject_serial_number.py Change license to BSD-2-Clause 2025-10-30 13:07:59 +01:00
Makefile ch552: Split functionality into separate files 2025-04-07 11:00:11 +02:00
README.md ch552: Add SPDX tags 2025-04-07 11:00:31 +02:00
REUSE.toml Follow REUSE specification 2025-10-30 13:07:59 +01:00

CH552 USB-to-Serial firmware

Toolchain setup

SDCC:

sudo apt install build-essential sdcc

chprog (for flashing the firmware to a device):

cd ~
sudo apt install libusb-1.0-0-dev
git clone https://github.com/ole00/chprog.git
cd chprog
./build_linux.sh
sudo cp chprog /usr/local/bin

Usage

Build the firmware using a default serial number:

make

Flash the firmware to a device:

make flash_patched

Re-programming the firmware

By design, once the USB to serial firmware is loaded onto the chip, there isn't an intended way to reflash it using only software. However, if 3.3V is applied to the D+ line through a 10K resistor during power-up, then the CH552 will enter bootloader mode, and a new firmware can be programmed onto the chip.

The Blinkinlabs CH55x Reset Controller can help you do this:

https://shop-nl.blinkinlabs.com/products/ch55x-reset-controller

https://github.com/Blinkinlabs/ch55x_programmer

Note that the CH552 flash is only guaranteed for a few hundred flash cycles.

License

Originally based on reference firmware for the CH552 by WCH released under the MIT license:

https://www.wch-ic.com/

The oldest files Copyright 1999.

Much changed and added to by Tillitis.

Check licenses using the reuse tool:

https://github.com/fsfe/reuse-tool

Note that so far you need to specify this directory as root, as in:

$ reuse --root . lint