- 32-bit RISC-V architecture
- Clock speed up to 48 MHz.
- 20KB flash memory for code.
- 4KB SRAM.
- 23 GPIO pins.
- 10-bit ADC
- Analog comparators
- PWM
- UARTs
- SPI
- I2C
- Timers
- Watchdog timer
- Support for low power and sleep modes.
Note ONLY Windows
You can add this software package directly on the IDE through the Arduino Boards Manager.
Add the following link in the "Additional Boards Managers URLs" field:
https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json
Then you can search for "wch" through the "board manager", find the installation package, and install it.
#define LED_PIN D5
void setup() {
pinMode(LED_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, LOW);
delay(1000);
digitalWrite(LED_PIN, HIGH);
delay(1000);
}
#define LED_PIN PC3
#define ML1_PIN PC0
#define ML2_PIN PC7
#define M1_PIN PC6
#define M2_PIN PC5
void setup() {
pinMode(LED_PIN, OUTPUT);
pinMode(ML1_PIN, OUTPUT);
pinMode(ML2_PIN, OUTPUT);
pinMode(M1_PIN, OUTPUT);
pinMode(M2_PIN, OUTPUT);
}
void loop() {
digitalWrite(LED_PIN, LOW);
digitalWrite(ML1_PIN, HIGH);
digitalWrite(ML2_PIN, LOW);
digitalWrite(M1_PIN, HIGH);
digitalWrite(M2_PIN, LOW);
delay(1000);
digitalWrite(ML1_PIN, LOW);
digitalWrite(ML2_PIN, LOW);
digitalWrite(LED_PIN, HIGH);
digitalWrite(M1_PIN, LOW);
digitalWrite(M2_PIN, LOW);
delay(1000);
}
Note Testing
Cargo is the package manager for the Rust programming language. It is included by default when you install Rust.
Installing Cargo and Rust
To install the Rust package manager (Cargo), follow the instructions for your operating system:
-- Linux and MacOS
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Closed and open Check if the installation worked:
cargo --version
-- Windows
-
Download the installer at https://www.rust-lang.org/tools/install and run it.
-
Open the command prompt and check the installation with:
cargo --version
- If it does not work, manually configure the environment variables:
CARGO_HOME=%USERPROFILE%.cargo
PATH=%CARGO_HOME%\bin
- Try checking the installation again with
cargo --version.
If you have any issues installing, open a ticket with the error.
WCHLink-E (Only work with WCHLink-E, no WCHLink). Buy in Aliexpress
cargo install --git https://github.com/ch32-rs/wlink
or download a binary from the Nightly Release page.
Note On Linux, you should install libudev and libusb development lib first. Like
sudo apt install libudev-dev libusb-1.0-0-devon Ubuntu.
wlink flash --address 0x08000000 firmware.bin
Note The firmware.bin file must be in the same directory where the command is executed.
> wlink flash --address 0x08000000 firmware.bin
12:10:26 [INFO] WCH-Link v2.10 (WCH-Link-CH32v003)
12:10:26 [INFO] Attached chip: CH32v003(0x30700518)
12:10:26 [INFO] Flashing 8068 bytes to 0x08000000
12:10:27 [INFO] Flash done
12:10:28 [INFO] Now reset...
12:10:28 [INFO] Resume executing...http://www.mounriver.com/download#:~:text=MounRiver_Studio_Setup_V191
cd /opt && unzip ~/Downloads/MRS_Toolchain_MAC_V170/xpack-riscv-none-embed-gcc-8.2.0.zip
export PATH=/opt/xpack-riscv-none-embed-gcc-8.2.0/bin:$PATH
git clone https://github.com/unixbigot/ch32v_evt_makefile_gcc_project_template.git -b macos_generate_fix
cd ch32v_evt_makefile_gcc_project_template
./generate_project_from_evt.sh ch32v003f4u6
make
Note Everything is very recent, we are testing.

