Multi-Protocol Programmer

Multi-Protocol Programmer

Resources

Resource Link
Wiki Development Boards Wiki
Documentation unit_multiprotocol_programmer_platform
Getting Started Initial Setup
Schematic & PCB Hardware Files
Firmware & SDK SDK & Firmware
Main Repository GitHub Repo

Firmware Required

This programmer requires specific firmware depending on the protocol:

  • AVR: USBasp & UPDI
  • ARM: CMSIS-DAP (SWD/JTAG)
  • CPLD: USB-Blaster (JTAG)

Load the correct .bin before use. Without it, the device won't function properly.

Overview

The Multi-Protocol Programmer is a USB tool based on the CH552 microcontroller. It supports flashing and debugging of:

  • AVR microcontrollers (ATmega, ATtiny, AVR-DA)
  • ARM Cortex-M devices (STM32, nRF52, SAM, etc.)
  • Intel/Altera MAX II CPLDs (EPM240, EPM570, etc.)

Features

  • USB Full-Speed (CDC/HID)
  • Voltage selector: 3.3V / 5V
  • SWD / JTAG / UPDI / USBasp support
  • Works with popular tools (avrdude, OpenOCD, Quartus, etc.)

PY32F0xx Configuration

The Multi-Protocol Programmer is fully compatible with PY32F0xx microcontrollers when using the CMSIS-DAP firmware.

Testing Status & Recommendations

Tested Devices โœ…

  • PY32F003x4 - Fully verified with this programmer
  • PY32F003x8 - Fully verified with this programmer

For the following devices that are supported in code but need hardware verification:

  • PY32F030 series (all variants)
  • PY32F002A series
  • PY32F002B series

This programmer is the recommended solution for testing these untested device variants.

Setup for PY32F0xx

  1. Flash CMSIS-DAP Firmware:

    python3 tools/chprog.py firmware/cmsis_dap.bin
    
  2. Connect to PY32F0xx:

    Programmer    PY32F0xx
    ----------    --------
    SWDIO      โ†โ†’ PA13
    SWDCK      โ†โ†’ PA14  
    GND        โ†โ†’ GND
    VTG        โ†โ†’ VCC (3.3V/5V)
    RST        โ†โ†’ NRST (optional)
    
  3. Set Correct Voltage:

    • Use 3.3V for most PY32F0xx devices
    • Check your specific device voltage requirements

Using with PyOCD

The programmer works seamlessly with PyOCD for PY32F0xx development:

# List connected devices
pyocd list

# Flash PY32F003
pyocd flash firmware.bin --target py32f003xx4

# Start GDB server
pyocd gdbserver --target py32f003xx4

# Interactive debugging
pyocd commander --target py32f003xx4

Using with OpenOCD

OpenOCD can also be used with the CMSIS-DAP firmware:

# Flash firmware
openocd -f interface/cmsis-dap.cfg -f target/py32f0xx.cfg -c "program firmware.bin verify reset exit"

# Start GDB server
openocd -f interface/cmsis-dap.cfg -f target/py32f0xx.cfg

Makefile Integration

Update your project Makefile to use the Multi-Protocol Programmer:

# Use CMSIS-DAP interface
PROGRAMMER = cmsis-dap
PROGRAMMER_ARGS = --target py32f003xx4

flash: $(BUILD_DIR)/$(EXAMPLE).bin
	pyocd flash $(BUILD_DIR)/$(EXAMPLE).bin $(PROGRAMMER_ARGS)

debug: $(BUILD_DIR)/$(EXAMPLE).elf
	pyocd gdbserver $(PROGRAMMER_ARGS) &
	arm-none-eabi-gdb $(BUILD_DIR)/$(EXAMPLE).elf

Supported Protocols

FirmwareProtocolsTarget DevicesInterfaceTools
AVRUSBasp, UPDIATmega, ATtinyCDC/HIDavrdude, Arduino IDE
CMSIS-DAPSWD, JTAGSTM32, nRF52, PY32F0xxHID+CDCOpenOCD, PyOCD, Keil
CPLDUSB-BlasterEPM240, EPM570, MAX IIHIDQuartus Prime

Flashing Firmware

  1. Enter Bootloader Mode:

    • Hold BOOT, plug USB, release.
  2. Flash Firmware:

    python3 tools/chprog.py firmware/firmware_name.bin
    

    Or use WCHISPTool on Windows.

Install Requirements

# Linux (Debian/Ubuntu)
sudo apt install build-essential sdcc python3-pip git
pip3 install pyusb pyocd

# Add user to dialout group for device access
sudo usermod -a -G dialout $USER
# Log out and back in for changes to take effect

For Windows: Download SDCC, Python 3, and Git.

Troubleshooting

Common Issues

  • Device not recognized? โžค Check firmware & USB drivers (use Zadig on Windows for CMSIS-DAP)

  • Programming error? โžค Verify voltage level (3.3V/5V), connections & cable quality

  • Slow upload? โžค Reduce SWD/JTAG frequency or use shorter cables

PY32F0xx Specific

  • PyOCD can't find device?

    # Check if programmer is detected
    pyocd list
    
    # Try different target specification
    pyocd flash firmware.bin --target py32f030xx4
    
  • SWD connection issues?

    • Verify SWDIO/SWDCK connections
    • Ensure stable power supply
    • Try lower SWD frequency: --frequency 1000000
  • Flashing fails?

    # Try mass erase first
    pyocd erase --chip --target py32f003xx4
    
    # Then flash
    pyocd flash firmware.bin --target py32f003xx4
    

Testing Contributions

Help expand device support! If you test py32f0xx-hal with untested devices using this programmer:

  1. Test procedure:

    • Flash basic examples (blinky, serial_echo)
    • Verify peripheral functionality
    • Document any issues or successes
  2. Report results:

    • Open GitHub issue with test results
    • Include device model, programmer setup, and example outcomes
    • Help us update the compatibility matrix

Firmware Selection Guide

For PY32F0xx development, use the CMSIS-DAP firmware:

Target FamilyRecommended FirmwareInterfaceTools
PY32F0xxCMSIS-DAPSWDPyOCD, OpenOCD
STM32F0xxCMSIS-DAPSWDPyOCD, OpenOCD
AVRUSBasp/UPDIISP/UPDIavrdude
MAX II CPLDUSB-BlasterJTAGQuartus

Performance Notes

SWD Frequency Settings

For reliable PY32F0xx programming:

  • High-speed: --frequency 10000000 (10MHz) - for short cables
  • Standard: --frequency 1000000 (1MHz) - recommended default
  • Low-speed: --frequency 400000 (400kHz) - for problematic connections

Cable Quality

  • Use short cables (< 15cm) for high-speed SWD
  • Twisted pair for SWDIO/SWDCK reduces noise
  • Good ground connection essential for reliable operation

License

  • Hardware: CC BY-SA 4.0
  • Firmware & Software: MIT License
  • Third-party components: see individual LICENSE files