Board reference · TENSTAR minimum system board

CH32V003F4P6

A tiny 48 MHz RISC-V controller with enough ADC, timers and serial hardware for sensors, motors, LEDs and low-cost dedicated controllers.

What is on this board?

48 MHz

QingKe RISC-V2A

32-bit RV32EC core with hardware interrupt support.

16 KB

Flash

Small by modern standards—prefer compact C and avoid large frameworks.

2 KB

SRAM

Use static buffers carefully. There is no room for large dynamic allocations.

10-bit

ADC

Eight external analog channels plus internal sources.

2 timers

Hardware PWM

One advanced and one general-purpose 16-bit timer.

SPI · I²C · UART

Serial buses

One peripheral of each type, multiplexed across the GPIO pins.

LEDs: what can you control?

Confirmed: use an external LED on PC3. No controllable onboard LED was found on this board revision. The PC3 sanity test produces three quick flashes followed by a pause.

Connect PC3 → 220Ω–1kΩ resistor → LED anode (+), then connect the LED cathode (−) to GND. Do not omit the resistor. PD7 was tested and produced a continuously lit LED because it is also NRST: driving it low resets the MCU.

USB-C and the V pins

Use only one power source. Confirmed on this board: the center programming pad labeled V (the "3.3 V" programming pin) outputs about 5 V while USB-C is plugged in. Every V pad is the same rail. Do not connect USB-C power and the WCH-LinkE 3V3 output at the same time.

The CH32V003 supports a VDD range of approximately 2.7–5.5 V, so the board runs fine at 5 V. On this minimal board, all pins marked V are one shared VCC rail. When powered from USB-C they sit near USB VBUS (~5 V); when powered only from the LinkE 3V3 pin they are ~3.3 V.

Practical consequence: at 5 V VDD, every GPIO high level and the ADC full-scale reference are 5 V. Power the MAX4466 from the same rail so its output cannot exceed VDD.

Power arrangementExpected V railSafe practice
USB-C onlyAbout 5 VLeave LinkE 3V3 disconnected; keep SWD and GND connected
WCH-LinkE onlyAbout 3.3 VConnect LinkE 3V3, GND and SWD; unplug USB-C
External regulated supply3.3 V or 5 VStay within MCU and peripheral ratings

Programming header

The three center pads on the underside are the programming header. The pad marked SWD is the board’s label for the CH32V003 single-wire PD1/SWIO signal.

WCH-LinkE RISC-V headerBoard center padPurpose
SWDIO / TMSSWDSingle-wire programming and debugging
3V3VTarget power only when USB-C is disconnected
GNDGCommon ground
RX and TX do not flash the chip. They are the LinkE’s USB-to-UART bridge. For optional serial output, connect LinkE RX to MCU PD5/TX; only connect LinkE TX to PD6/RX if the firmware needs incoming serial.

Useful pin map

FunctionPractical default pinsNotes
DebugPD1 / center SWD padReserve while developing
UARTPD5 TX, PD6 RXPD6 may also drive the user LED
SPIPC5 SCK, PC6 MOSI, PC7 MISOChoose an available GPIO for chip select
I²CPC1 SDA, PC2 SCLExternal pull-ups are normally required
AnalogPA2 A0, PA1 A1, PC4 A2, PD2 A3, PD3 A4, PD5 A5, PD6 A6, PD4 A7ADC input must remain between GND and VDD
PWM examplesPC3 TIM1_CH3, PD2 TIM1_CH1, PD3 TIM2_CH2Volume LED plus bidirectional haptics
ResetPD7 / NRSTReset function depends on option-byte configuration

Best first sanity test

Install both WCH-Link and WCH-LinkSER Windows drivers.
Put the LinkE in RISC-V mode. The expected USB VID:PID is 1A86:8010.
With USB-C disconnected, connect SWDIO→SWD, 3V3→V and GND→G.
Open PlatformIO/01_Starters_Tests/CH32V003SanityTest and run upload.bat.
Connect a 3 mm LED: PC3 → resistor → LED + and LED − → GND. Do not use PD7.
Look for a repeating “three quick flashes, pause” pattern on the external LED.
cd PlatformIO\01_Starters_Tests\CH32V003SanityTest
pio run
pio run -t upload

Current haptics wiring

PartBoard pinFunction
MAX4466 OUTPC4 / A210-bit ADC audio input
External LED + resistorPC3 / TIM1_CH3Hardware-PWM microphone volume
H-bridge IN1PD2 / TIM1_CH1Forward motor PWM
H-bridge IN2PD3 / TIM2_CH2Reverse motor PWM

PC3 and PD2 share TIM1 but use separate capture/compare channels, so LED brightness does not alter motor duty. PD3 uses TIM2 independently.

Important limitations