Skip to content

Commit ab33f17

Browse files
committed
boards: wch: add the ch32v006evt
The WCH CH32V006EVT is an evaluation board for the RISC-V based CH32V006K8U6 SOC. The board is equipped with a power LED, reset button, USB port for power, and two user LEDs. Add the board definition, documentation, and sample overlay. Signed-off-by: Michael Hope <[email protected]>
1 parent be466ae commit ab33f17

File tree

11 files changed

+271
-0
lines changed

11 files changed

+271
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright (c) 2024 Michael Hope
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config BOARD_CH32V006EVT
5+
select SOC_CH32V006K8U

boards/wch/ch32v006evt/board.cmake

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright (c) 2025 Michael Hope <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
board_runner_args(minichlink)
5+
include(${ZEPHYR_BASE}/boards/common/minichlink.board.cmake)
6+
7+
board_runner_args(openocd "--use-elf" "--cmd-reset-halt" "halt")
8+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

boards/wch/ch32v006evt/board.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
board:
2+
name: ch32v006evt
3+
full_name: WCH CH32V006EVT
4+
vendor: wch
5+
socs:
6+
- name: ch32v006
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (c) 2025 Michael Hope <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/pinctrl/ch32v00x-pinctrl.h>
8+
9+
&pinctrl {
10+
usart1_default: usart1_default {
11+
group1 {
12+
pinmux = <USART1_TX_PD5_0>;
13+
output-high;
14+
drive-push-pull;
15+
};
16+
group2 {
17+
pinmux = <USART1_RX_PD6_0>;
18+
bias-pull-up;
19+
};
20+
};
21+
22+
usart2_default: usart2_default {
23+
group1 {
24+
pinmux = <USART2_TX_PA7_0>;
25+
output-high;
26+
drive-push-pull;
27+
};
28+
group2 {
29+
pinmux = <USART2_RX_PB3_0>;
30+
bias-pull-up;
31+
};
32+
};
33+
34+
i2c1_default: i2c1_default {
35+
group1 {
36+
pinmux = <I2C1_SDA_PC1_0>, <I2C1_SCL_PC2_0>;
37+
output-high;
38+
drive-open-drain;
39+
};
40+
};
41+
};
+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2025 Michael Hope <[email protected]>
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
/dts-v1/;
7+
8+
#include <wch/ch32v0/ch32v006k8u.dtsi>
9+
#include "ch32v006evt-pinctrl.dtsi"
10+
11+
#include <zephyr/dt-bindings/gpio/gpio.h>
12+
#include <zephyr/dt-bindings/i2c/i2c.h>
13+
14+
/ {
15+
model = "ch32v006evt";
16+
compatible = "wch,ch32v006";
17+
18+
chosen {
19+
zephyr,sram = &sram0;
20+
zephyr,flash = &flash0;
21+
zephyr,console = &usart1;
22+
zephyr,shell-uart = &usart1;
23+
};
24+
25+
leds {
26+
compatible = "gpio-leds";
27+
28+
/*
29+
* Please connect the unconnected LED1 on the WCH CH32V006EVT
30+
* board to PD0 and then change this status to "okay".
31+
*/
32+
status = "disabled";
33+
34+
blue_led1: led1 {
35+
gpios = <&gpiod 0 GPIO_ACTIVE_LOW>;
36+
};
37+
38+
blue_led2: led2 {
39+
gpios = <&gpiob 4 GPIO_ACTIVE_LOW>;
40+
};
41+
};
42+
43+
aliases {
44+
led0 = &blue_led1;
45+
};
46+
};
47+
48+
&clk_hse {
49+
clock-frequency = <DT_FREQ_M(24)>;
50+
status = "okay";
51+
};
52+
53+
&pll {
54+
clocks = <&clk_hse>;
55+
status = "okay";
56+
};
57+
58+
&rcc {
59+
clocks = <&pll>;
60+
};
61+
62+
&gpioc {
63+
status = "okay";
64+
};
65+
66+
&gpiod {
67+
status = "okay";
68+
};
69+
70+
&usart1 {
71+
status = "okay";
72+
current-speed = <115200>;
73+
pinctrl-0 = <&usart1_default>;
74+
pinctrl-names = "default";
75+
};
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
identifier: ch32v006evt
2+
name: WCH CH32V006 Evaluation Board
3+
type: mcu
4+
arch: riscv
5+
toolchain:
6+
- cross-compile
7+
- zephyr
8+
ram: 8
9+
flash: 62
10+
supported:
11+
- gpio
12+
- i2c
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2025 Michael Hope <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_GPIO=y
5+
CONFIG_SERIAL=y
6+
CONFIG_CONSOLE=y
7+
CONFIG_UART_CONSOLE=y
35.8 KB
Binary file not shown.

boards/wch/ch32v006evt/doc/index.rst

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
.. zephyr:board:: ch32v006evt
2+
3+
Overview
4+
********
5+
6+
The `WCH`_ CH32V006EVT is an evaluation board for the RISC-V based CH32V006K8U6
7+
SOC.
8+
9+
The board is equipped with a power LED, reset button, USB port for power, and
10+
two user LEDs. The `WCH webpage on CH32V006`_ contains the processor's
11+
information and the datasheet.
12+
13+
Hardware
14+
********
15+
16+
The QingKe 32-bit RISC-V2C processor of the WCH CH32V006EVT is clocked by an
17+
external crystal and runs at 48 MHz.
18+
19+
Supported Features
20+
==================
21+
22+
.. zephyr:board-supported-hw::
23+
24+
Connections and IOs
25+
===================
26+
27+
LED
28+
---
29+
30+
* LED1 = Unconnected. Connect to an I/O pin (PD0).
31+
* LED2 = Unconnected. Connect to an I/O pin (PB4).
32+
33+
Programming and Debugging
34+
*************************
35+
36+
.. zephyr:board-supported-runners::
37+
38+
Applications for the ``ch32v006evt`` board can be built and flashed
39+
in the usual way (see :ref:`build_an_application` and :ref:`application_run`
40+
for more details); however, an external programmer is required since the board
41+
does not have any built-in debug support.
42+
43+
Connect the programmer to the following pins on the PCB:
44+
45+
* VCC = VCC (do not power the board from the USB port at the same time)
46+
* GND = GND
47+
* SWIO = PD1
48+
49+
Flashing
50+
========
51+
52+
You can use minichlink_ to flash the board. Once ``minichlink`` has been set
53+
up, build and flash applications as usual (see :ref:`build_an_application` and
54+
:ref:`application_run` for more details).
55+
56+
Here is an example for the :zephyr:code-sample:`blinky` application.
57+
58+
.. zephyr-app-commands::
59+
:zephyr-app: samples/basic/blinky
60+
:board: ch32v006evt
61+
:goals: build flash
62+
63+
Debugging
64+
=========
65+
66+
This board can be debugged via OpenOCD or ``minichlink``.
67+
68+
Testing the LED on the WCH CH32V006EVT
69+
**************************************
70+
71+
The `blinky` sample can be used to test that the LEDs on the board are working
72+
properly with Zephyr:
73+
74+
* :zephyr:code-sample:`blinky`
75+
76+
You can build and flash the examples to make sure Zephyr is running
77+
correctly on your board. The LED definitions can be found in
78+
:zephyr_file:`boards/wch/ch32v006evt/ch32v006evt.dts`.
79+
80+
References
81+
**********
82+
83+
.. target-notes::
84+
85+
.. _WCH: http://www.wch-ic.com
86+
.. _WCH webpage on CH32V006: https://www.wch-ic.com/downloads/CH32V006DS0_PDF.html
87+
.. _minichlink: https://github.com/cnlohr/ch32fun/tree/master/minichlink
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#interface wlink
2+
adapter driver wlink
3+
wlink_set
4+
set _CHIPNAME riscv
5+
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x00001
6+
7+
set _TARGETNAME $_CHIPNAME.cpu
8+
9+
target create $_TARGETNAME.0 riscv -chain-position $_TARGETNAME
10+
$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 10000 -work-area-backup 1
11+
set _FLASHNAME $_CHIPNAME.flash
12+
13+
flash bank $_FLASHNAME wch_riscv 0x00000000 0 0 0 $_TARGETNAME.0
14+
15+
echo "Ready for Remote Connections"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (c) 2025 Michael Hope <[email protected]>
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
aliases {
9+
watchdog0 = &iwdg;
10+
};
11+
};
12+
13+
&iwdg {
14+
status = "okay";
15+
};

0 commit comments

Comments
 (0)