CH32V003 - What's That?

Shade

Hm?

What's this?

...A microcontroller?

Yeah, but look at the price

Only ten cents?

That's... suspiciously cheap. I've used Arduino boards, ESP8266, ESP32. But I've never heard of this one

So?

So I guess I'll have to find out what it is

Okay. It's a CH32V003, made by WCH

It's a 32-bit microcontroller based on WCH's QingKe RISC-V2A core. It can run at up to 48 MHz, has 16 KB of Flash and 2 KB of SRAM, and supports 3.3 V or 5 V operation

So basically a tiny computer

Technically, yes

While looking into it, I found this EEVblog video

The more I looked at the chip, the more interesting it became

It's obviously not going to replace an ESP32. Two kilobytes of RAM is laughably small compared to what I'm used to

You say that like two kilobytes isn't enough to run an entire civilization

The point is that the CH32V003 isn't trying to be an ESP32 It's an extremely inexpensive general-purpose MCU

If all you need is some GPIO, a timer, an ADC, a serial interface, or a small control program, you don't necessarily need a much more powerful chip.

Look!


So you bought one

Yes

Of course you did

Unlike the Arduino ecosystem I'm used to, I couldn't just plug the board in, open Arduino IDE, select a board, and immediately press upload

So we need another IDE


And another programmer

And another utility

After installing the necessary tools and getting the WCH-LinkE recognized, I created a simple project in MounRiver Studio.
Shade· c#include "debug.h"
#define LED_PIN GPIO_Pin_6
#define LED_PORT GPIOD
void GPIO_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure = {0};
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = LED_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(LED_PORT, &GPIO_InitStructure);
}
int main(void)
{
SystemCoreClockUpdate();
Delay_Init();
GPIO_Config();
while (1)
{
GPIO_SetBits(LED_PORT, LED_PIN);
Delay_Ms(500);
GPIO_ResetBits(LED_PORT, LED_PIN);
Delay_Ms(500);
}
}
Look, the LED is blinking


So... what are we building with it?

I don't know yet

Then I have an idea