Skip to main content

Multi-Protocol Programmer

VersionLanguageLanguageLicense
Multi-Protocol Programmer
⚠️ IMPORTANT WARNING

Users must load specific firmware according to their needs.

This programmer requires you to load the corresponding firmware for the protocol you want to use:

  • AVR Firmware for ATmega/ATtiny devices
  • CMSIS-DAP Firmware for ARM Cortex-M microcontrollers
  • CPLD Firmware for Intel/Altera MAX II devices

Without the appropriate firmware, the device will not work correctly.

Overview

The Multi-Protocol Programmer is a versatile USB device based on the CH552 microcontroller that supports multiple programming and debugging protocols. Compatible with AVR, ARM Cortex-M, and Intel/Altera MAX II CPLD devices.

Key Features

  • 🔌 USB Full-Speed Interface (CDC/HID depending on firmware)
  • Voltage selector: 3.3V / 5V with switch
  • 🔄 Interchangeable firmware for different protocols
  • 🛠️ Compatible with industry-standard tools

Resources and Documentation

ResourceDescriptionLink
📚 Complete DocumentationDetailed programmer guideView Documentation
🚀 Getting StartedInitial setup tutorialStart Here
📋 SchematicElectronic circuit designView Schematic
🔧 PCB DesignBoard design filesView Design
💻 FirmwareSource code and binariesView Code
🧪 Development SDKCH55x development toolsView SDK
📦 Main RepositoryComplete source codeGitHub

Technical Specifications

Base Hardware

  • Microcontroller: CH552G / CH552E / CH552P
  • USB Interface: Full-Speed (12 Mbps)
  • Power Supply: USB Bus (5V) with internal regulator
  • Output Voltage: Selectable 3.3V / 5V via switch
  • Connectors: Standard pin headers for programming connections

Supported Protocols

  • 🔌 AVR: USBasp, Serial UPDI
  • 🛡️ ARM: SWD (CMSIS-DAP)
  • ⚙️ CPLD: JTAG (USB-Blaster compatible)

Available Firmware Profiles

📋 Firmware Selection

Each firmware is optimized for a specific type of device. You must load the correct firmware before using the programmer.

1. 🔧 AVR Programmer Firmware

For AVR microcontrollers (ATmega, ATtiny, etc.)

Features:

  • Protocols: USBasp
  • Target devices: Complete Microchip AVR family
  • USB Interface: HID (USBasp) / CDC (Serial UPDI)
  • Voltage: Selectable 3.3V or 5V

Compatible tools:

  • avrdude
  • ✅ Arduino IDE

Compilation:

# Compile with SDCC 
make all

# Or flash precompiled binary
python3 ./tools/chprog.py build/main.bin

Example of flashing precompiled binary:

Python3 is native in most Linux distributions, but you can install it on Windows or macOS with limited support.

make flash 
Compilando main.c ...
Compilando src/delay.c ...
Compilando src/isp.c ...
Compilando src/tpi.c ...
Compilando src/updi.c ...
Compilando src/usb_asp.c ...
Compilando src/usb_cdc.c ...
Compilando src/usb_descr.c ...
Compilando src/usb_handler.c ...
Enlazando IHX...
Generando BIN...
------------------
FLASH: 5341 bytes
IRAM: 36 bytes
XRAM: 480 bytes
------------------
Eliminando temporales...
Flasheando a CH55x...
Connecting to device ...
FOUND: CH552 with bootloader v2.5.0.
Erasing chip ...
Flashing build/main.bin to CH552 ...
SUCCESS: 5341 bytes written.
Verifying ...
SUCCESS: 5341 bytes verified.
DONE.
💡 Technical Note

USBasp mode enumerates as HID device, while Serial UPDI uses virtual CDC port.


2. 🛡️ ARM Debugger Firmware (CMSIS-DAP)

For ARM Cortex-M microcontrollers

Features:

  • Protocols: SWD and JTAG (CMSIS-DAP standard)
  • Target devices: STM32, PY32, RP2040, etc.
  • USB Interface: HID + optional CDC

Compatible tools:

  • OpenOCD
  • ✅ PyOCD
  • ✅ Visual Studio Code (PlatformIO Extension)
  • ✅ Visual Studio Code (Raspberry Pi Pico Extension)

Drivers:

  • Linux/macOS: Native support (no additional drivers)
  • Windows: Automatic drivers via WinUSB
⚠️ Compatibility

Some IDEs may require specific configuration to recognize the device as CMSIS-DAP.


3. ⚙️ CPLD Programmer Firmware

For Intel/Altera MAX II devices

Features:

  • Target devices: EPM240, etc.
  • Protocol: JTAG via USB-Blaster emulation
  • Compatibility: Intel Quartus Prime (lite version)
  • Speed: USB-Blaster specification compliant

Configuration options:

  • Safe mode (default): VID:0x16C0 PID:0x05DC
  • Compatibility mode: VID:0x09FB PID:0x6001
🚨 Compatibility Mode

Compatibility mode uses Intel VID/PID. Use only for personal development and comply with corresponding licenses.

Installation and Setup

System Requirements

Required software:

# Ubuntu/Debian
sudo apt install build-essential sdcc python3 python3-pip git

# Install Python dependencies
pip3 install pyusb

# Verify installation
sdcc --version
python3 --version

For Windows:

CH55x Docker SDK

Firmware Flashing Process

1. Enter Bootloader Mode

📝 Step-by-step procedure:
  1. Disconnect the programmer from USB completely
  2. Hold down the BOOT button on the board
  3. Connect the USB cable while keeping BOOT pressed
  4. Release the button - device enters bootloader mode
  5. The LED should change state indicating bootloader mode

2. Flash the Firmware

# Method 1: Using chprog.py (Recommended)
python3 ./tools/chprog.py build/main.bin

# Method 2: Using WCHISPTool (Windows)
# Open WCHISPTool and select the .bin file

3. Verify Installation

# Verify device is recognized
lsusb | grep -i "ch55"

# For Windows, check in Device Manager

Permission Setup (Linux)

# Create udev rules for unprivileged access
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="4348", ATTR{idProduct}=="55e0", MODE="666"' | sudo tee /etc/udev/rules.d/99-ch55x.rules

# Reload rules
sudo udevadm control --reload
sudo udevadm trigger

# Add user to dialout group (for serial ports)
sudo usermod -a -G dialout $USER

Firmware Compatibility Table

FirmwareProtocolsTarget DevicesUSB ModeMain Tools
AVRUSBaspATmega, ATtiny, AVR-DA/DBCDC/HIDavrdude, PlatformIO
CMSIS-DAPSWDSTM32, RP2040, PY32HID+CDCOpenOCD, PyOCD
CPLDJTAG (USB-Blaster)EPM240, EPM570, MAX IIHIDQuartus Prime

Common Troubleshooting

❌ Device not recognized

Possible causes and solutions:

  1. Wrong firmware loaded

    • Verify firmware corresponds to intended use
    • Re-flash the correct firmware
  2. Driver issues (Windows)

    # Install Zadig for libusb drivers
    # Select device and install WinUSB driver
  3. Insufficient permissions (Linux)

    # Check udev rules
    sudo udevadm test /sys/bus/usb/devices/[device_path]

❌ Programming error

  1. Verify cable connections
  2. Check target voltage (3.3V vs 5V)
  3. Verify target device is powered
  4. Check protocol compatibility

❌ Slow programming speed

  1. Reduce JTAG/SWD frequency
  2. Verify connection quality
  3. Use shorter cables

Licenses and Attributions

This project is distributed under multiple licenses depending on the component:

  • Hardware: Creative Commons Attribution-ShareAlike 4.0
  • Base firmware: MIT License
  • Derived components: Specific licenses from each base project
📄 Important

Consult the LICENSE file in each firmware directory for specific licensing details.