WCH RISC-V microcontrollers can now be programmed with the Arduino IDE

WCH has launched some interesting RISC-V microcontrollers in the last year or so, including the “10 cents” CH32V003 RISC-V microcontroller with 2KB SRAM and 16KB flash or the CH32V307with more resources (up to 64KB SRAM and 256KB flash) and additional peripherals.

So far they were programmable in C language using MounRiver IDE or an open-source toolchain, but WCH has now announced Arduino support for many of those RISC-V microcontrollers which should enable more people to get involved.

WCH RISC-V Arduino

The core library for CH32duino works with OpenOCD through WCH-LINKE hardware to download the firmware and debug WCH chips and a riscv-none-embed-gcc toolchain that supports custom RISC-V instructions (half-word and byte compression instruction extensions and hardware stack push/pop functions) found in WCH RISC-V microcontroller.

The following evaluation kits are currently supported with ADC, DAC, USART, GPIO, EXTI, SysTick, I2C, and SPI peripherals:

  • CH32V003F4P EVT board
  • CH32V203G8U EVT board
  • CH32X035G8U EVT board
  • CH32V103R8T6_BLACK EVT board
  • CH32V307VCT6_BLACK EVT board

You’ll need to add the following link to the “Additional Boards Managers URLs” field in the Arduino 2.0 IDE: https://github.com/openwch/board_manager_files/raw/main/package_ch32v_index.json, and install CH32 MCU EVT Boards by WCH, and you’ll then be able to select a RISC-V board such as CH32V00x as shown in the screenshot below.

Arduino WCH RISC-V CH32 MCU EVT boards

It works with Windows, Linux, and Mac OS with some OS-specific tweaks. You’ll find documentation and source code on the relevant GitHub repository. Those who prefer watching videos can also check out the getting started video embedded below.

Share this:

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard
Subscribe
Notify of
guest
The comment form collects your name, email and content to allow us keep track of the comments placed on the website. Please read and accept our website Terms and Privacy Policy to post a comment.
11 Comments
oldest
newest
David Willmore
David Willmore
10 months ago

This should be fun!

italo oliveira
10 months ago

Now you got my attention O.O

zoobab
10 months ago

I am working on the arduino-cli port with Ardulink support and minichlink, inside a docker image:

https://gitlab.com/zoobab/ch32v003-arduino-cli

zoobab
10 months ago

BTW I was unable to flash 3.3V boards from an Arduino in 5V, i tried a level shifter in between without any success. If someone has a solution…

David Willmore
David Willmore
10 months ago

Can you describe in a bit more detail what you were doing? Were you using a Adruino UNO or something with 5V I/O as a programmer for a 3.3V CH32V003 board? All the other programmers use target Vcc as Vio, IIRC. You say you’ve used a level shifter, but that’s problematic with bidirectional signals like the CH32V003 uses for its program/debug signal.

zoobab
10 months ago

What worked was flashing a CH32V003 SOP16 soldered to a breakout board in 5V, with an Arduino UNO in 5V. What did not worked was trying to flash a nanoCh32v003 (which has the SWIO in 3.3V on the PCB) with 1. the same Arduino in 5V, connected to the board on its VCC pin connected to 5V (bypassing the 5V-3.3V voltage regulator) 2. the same Arduino in 5V, but with a bidirectional level shifter to go down from 5V to 3.3V. I think I should also try a simple resistor to see if does the job. I am having a… Read more »

David Willmore
David Willmore
10 months ago

For the nanoCh32v003 case, you have the 5V Vcc of the arduino connected to the 3.3V pin on the nanoCh32v003? I assume that’s how you’re bypassing the regulator. In that case, you’re just programming the CH32V003 as a normal 5V part and it should work just fine. You’re saying that it does not? The bidirectional level shifter case will be very problematic due to the high speed of the signals involved. You may need to refactor the design to use a dedicated 5->3.3V converter with OE and a separate GPIO on the 5V arduino as an input/sense line of that… Read more »

zoobab
10 months ago

Will retry with some resistors to see if it can do the job from going down from 5V to 3.3V.

This blog lists many possible options:

5V to 3.3V logic level translation/conversion/shifting: how to interface a 5V output to a 3.3V input. – next-hack.com

David Willmore
David Willmore
10 months ago

That blog post is pretty good! Thanks.

fanoush
fanoush
10 months ago

CH32V305 not in the list but hopefully can be addded, that one has high speed 480Mbit USB like CH32V307 and is cheaper (with less RAM/flash of course). The Wchlink E JTAG/SWD dongle is based on this chip and is < $3-$4 on aliexpress. May be a successor to Stlink V2 clone dongles.

behzad abf
behzad abf
10 months ago

just perfect.. yooohooo

Boardcon Rockchip and Allwinner SoM and SBC products