WCH CH32V003F4P6 Development Board

Overview

The WCH [1] CH32V003F4P6 Development Board hardware provides support for QingKe 32-bit RISC-V2A processor and the following devices:

  • CLOCK

  • GPIO

  • NVIC

The board is equipped with one LED, wired to PD1 and SWIO pins. The WCH webpage on CH32V003 [2] contains the processor’s information and the datasheet.

Hardware

The QingKe 32-bit RISC-V2A processor of the WCH CH32V003F4P6_DEV_BOARD is clocked by an internal RC oscillator and runs at 24 MHz.

Supported Features

The ch32v003f4p6_dev_board board supports the hardware features listed below.

on-chip / on-board
Feature integrated in the SoC / present on the board.
2 / 2
Number of instances that are enabled / disabled.
Click on the label to see the first instance of this feature in the board/SoC DTS files.
vnd,foo
Compatible string for the Devicetree binding matching the feature.
Click on the link to view the binding documentation.
ch32v003f4p6_dev_board
/
ch32v003

Type

Location

Description

Compatible

CPU

on-chip

WCH QingKe V2 RISC-V MCU1

wch,qingke-v2

Clock control

on-chip

WCH CH32V00x Reset and Clock Control (RCC)1

wch,rcc

on-chip

WCH CH32V00x HSE Clock1

wch,ch32v00x-hse-clock

on-chip

WCH CH32V00x HSI Clock1

wch,ch32v00x-hsi-clock

on-chip

Generic fixed-rate clock provider1

fixed-clock

on-chip

WCH CH32V00x PLL1

wch,ch32v00x-pll-clock

DMA

on-chip

WCH DMA controller1

wch,wch-dma

GPIO & Headers

on-chip

WCH CH32V00x General-Purpose Input/Output (GPIO)3

wch,gpio

Interrupt controller

on-chip

WCH CH32V00x Programmable Fast Interrupt Controller (PFIC)1

wch,pfic

LED

on-board

Group of GPIO-controlled LEDs1

gpio-leds

MTD

on-chip

Flash node1

soc-nv-flash

Pin control

on-chip

WCH CH32V00x AFIO1

wch,afio

Serial controller

on-chip

WCH CH32V00x UART1

wch,usart

SRAM

on-chip

Generic on-chip SRAM description1

mmio-sram

Timer

on-chip

WCH CH32V00x Systick1

wch,systick

Connections and IOs

LED

  • LED1 (red) = PD1

Programming and Debugging

Applications for the ch32v003f4p6_dev_board board target can be built and flashed in the usual way (see Building an Application and Run an Application for more details); however, an external programmer is required since the board does not have any built-in debug support.

The following pins of the external programmer must be connected to the following pins on the PCB (see image):

  • VCC = VCC (do not power the board from the USB port at the same time)

  • GND = GND

  • SWIO = PD1

Flashing

SWIO pin is connected to PD1 and also to led on the board. By default, the function of PD1 is SWD. To use the led on the board, the function of PD1 is changed to GPIO if PD1 is not put to ground (see boards/wch/ch32v003f4p6_dev_board/board.c). In order to be able to reflash the board, if some zephyr application is already loaded in flash, power on the board with PD1 put to ground to let PD1 as SWIO. After that, reconnect the external debugger SWDIO pin to PD1/SWIO to be able to flash the board using the external debugger.

You can use minichlink to flash the board. Once minichlink has been set up, build and flash applications as usual (see Building an Application and Run an Application for more details).

Here is an example for the Blinky application.

# From the root of the zephyr repository
west build -b ch32v003f4p6_dev_board samples/basic/blinky
west flash

Debugging

This board can be debugged via OpenOCD or minichlink.

Testing the LED on the WCH CH32V003F4P6_DEV_BOARD

There is 1 sample program that allow you to test that the LED on the board is working properly with Zephyr:

samples/basic/blinky

You can build and flash the examples to make sure Zephyr is running correctly on your board. The button and LED definition can be found in boards/wch/ch32v003f4p6_dev_board/ch32v003f4p6_dev_board.dts.

References