
Time to progress with my exploration of microcontroller platforms. I'll be focusing on the RISC-V 32 MCUs which are now commodity chips, in particular the WCH 32V series. To be sure, I've already made initial forays in this area.
Instead of writing a long detail document, I'll spin off digressions into logs instead of boring everybody to tears with constant updates where it's hard to discern what has been updated.
First off, a history of the MCU families that I've delved into.
Next, an exploration of candidate MCU families.
A brief survey of the toolchain scene.
The WCH 32V series of MCUs
Now we get to the actual hardware that I've decided to develop for. The CH32V003 family is one of the offerings of the Nanjing Qingheng Microelectronics company. These MCU ICs got the attention of developers and hobbyists for their low price. This family of 20 pin and below MCUs aims to capture some of the base functionality MCU market, which coincidentally or not, have 003 somewhere in the model name, e.g. STM8F003, STM32F003. Higher members of the CH32V family offer more peripherals and more pins.
If you go shopping in the usual bazaars, this is a module you will commonly see:

Another variant has a TSSOP-20 package instead of the QFP-20 package in the middle. Notice the 3 pins to the programming dongle.
I've decided to go for the module shown in the topmost picture, one of the BTE series made by a different factory. It doesn't have the USB-C connector but has an onboard 24 MHz crystal which could come in handy for more precise timing.
I've decided to not attempt to design around the bare MCU but use the BTE module as a component. They pack more on the module than I could with my SMD soldering skills and sell it cheaper than I could buy the components for. You can see how small it is, about the size of a 20 pin 0.6 inch DIP IC. A price of tens of cents for the bare MCU is tempting, but so is the price of only a dollar or two, quantity 10 shipping included, for the module. Tested working too. The drawback is that these module will raise the height of the entire assembly if pulgged into Dupont pin sockets, unless I'm willing to solder them more or less permanently onto the base PCB.
RISC-V IDE and compiler toolchains
The toolchain suggested by the manufacturer is MounRiver Studio. There are secondary sites, as the original site isn't the fastest. Arduino also supports the WCH chips now, but of course with their HAL. The actual compiler tools are available separately if you want to develop from the CLI and use automated build tools, a prebuilt one being the xPack tools. And of course you can also build the compiler tools from the gcc sources, but you need to know which compiler flags to use for the ISA of the WCH chips. Things move quickly in this world, so check that the information you have is current. For example for a long time MounRiver Studio was at 1.92, but now I see that 2.40 has been out for a few months, and it seems it's not based on Eclipse any more but on the VSCode editor.
Rust HAL and libraries
One option I didn't mention in the toolchain survey is the programming language Rust. Writing in C or C++ has got boring so I want to challenge myself with something new. Rust will generate larger binaries than C due to the layers of abstraction so it's just as well that my intended MCU target the WCH32V003 has 16kB flash memory. So I wrote a log entry about installing a Rust toolchain. I'll start with a text editor and the CLI interface and think about IDEs later.
Next thing is to write a simple Rust program, maybe blinky. As explained in the log, versions for several MCU targets can be generated with a single toolchain.
(To be continued.)
Ken Yap







Lee Djavaherian
Colin O'Flynn
ziggurat29
Wassim