Skip to content

vanbwodonk/RP2040_SWIO_Programmer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

RP2040 SWIO Programmer

A CH32 RISC-V programmer using the RP2040 PIO to implement the Single-Wire I/O (SWIO) protocol. Works with minichlink from the ch32fun toolchain.

Features

  • Uses RP2040 PIO state machines for accurate SWIO timing
  • Works with minichlink over serial (Ardulink protocol)
  • Configurable SWIO GPIO pin
  • Tested with CH32V003

Hardware Setup

Connect the SWIO pin to your CH32 target through a 1KΩ pull-up resistor to 3.3V:

          VCC (3.3V)
             │
            ┌┤
           1KΩ
            └┤
             │
RP2040 ──────┼────── SWIO (CH32)
  GPIO       │
          GND

The SWIO pin is configurable in src/main.cpp:

#define SWIO_PIN 29

Any GPIO can be used — just change the define and rebuild.

Usage with minichlink

Chip ID detection

Connect the programmer via USB, then:

minichlink -c /dev/ttyACM0 -b

Expected output on a CH32V003:

VID:0x1209, PID:0xb003
Opening serial port /dev/ttyACM0 at 115200 baud.
Ardulink: synced.
Found Ardulink Programmer
Ardulink: target power 1
Interface Setup
Detected CH32V003
Flash Storage: 16 kB
Part UUID: 3d-a4-ab-cd-a5-b2-bc-41
Part Type: 00-30-05-00
Read protection: disabled

Flash Firmware

This test firmware is blinking in PIN D4.

minichlink -c /dev/ttyACM0 -w Test/blink.bin 0x08000000 -b

Output :

WARNING: You are not in the plugdev/dialout group, the canned udev rules will not work on your system.
VID:0x1209, PID:0xb003
Opening serial port /dev/ttyACM0 at 115200 baud.
Ardulink: synced.
Found Ardulink Programmer
Ardulink: target power 1
Interface Setup
Detected CH32V003
Flash Storage: 16 kB
Part UUID: 3d-a4-ab-cd-a5-b2-bc-41
Part Type: 00-30-05-00
Read protection: disabled
Detecting Memory Area
Writing image

Image written.

Credits / Reference Code

About

CH32 programmer with RP2040

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages