Board

CH32V003 simulator, the cheapest RISC-V chip

The WCH CH32V003 is a 48 MHz RISC-V chip with 16 KB of flash and 2 KB of RAM. Mokxi runs its CH32V003F4P6 on a twenty-pin breakout, at the chip’s real register addresses, with a first version of its peripherals. This page says what is in and what is not.

Start building free
  • 6peripheral areas modeled
  • 1project ready to run
  • Real timeon your own machine
WCH CH32V003: blinklive0.000 s 0.00x
Click to open it in the editor
The board is running real firmware right now. Click it to open the circuit in the editor.
The model

What is modeled

Taken from the board's own contract document and put in plain words, with what is missing beside it.

Modeled

Core
The QingKe V2A as RV32EC: sixteen registers, no multiply or divide, one instruction per HCLK cycle
Clock
HSI at 24 MHz, the PLL for 48 MHz, and HPRE, so the program sets the speed it runs at
GPIO
Ports A, C and D with push-pull, open drain, pull-up, pull-down and analog modes, and clock gating through RCC
USART1
TX on PD5 and RX on PD6 at the baud rate the program sets, polled, wired to the serial monitor
ADC1
Ten bits against VDD on channels 0 to 7, one software-triggered conversion at a time
SysTick
The 32-bit up counter and its compare flag, behind millis(), micros() and delay()

Not modeled

  • Interrupts. The PFIC is not modeled, so SysTick, EXTI and USART interrupts never fire: attachInterrupt() does not exist, and a program polls.
  • PWM (the timers), so no analogWrite() or tone(), and no I2C or SPI, so no Wire or SPI.
  • USART and AFIO pin remaps, the option bytes, flash programming, the watchdogs and auto wakeup.
  • WCH’s XW compressed instructions and the trap on registers x16 and up. A program built with WCH’s own compiler that uses XW traps here.
  • PD7 as the reset pin: it is a plain GPIO on this breakout.
Start here

Open one and press Run

Each of these opens in the editor exactly as it is drawn here.

Questions

Is it free?

Yes. Every board and every part is on the free plan, with no account needed.

Which pin numbers does it use?

The openwch core’s names: PA1, PA2, PC0 to PC7 and PD0 to PD7, and A0 to A7 for the ADC channels. A bare number is the port times 8 plus the bit, with A = 0, C = 8 and D = 16, so PD2 is 18.

Why does my pin do nothing?

On the real chip a port ignores writes until its clock is on in RCC. Mokxi does the same: pinMode() turns the clock on for you, but a program that writes the registers directly has to.

Why does a second byte typed into Serial go missing?

There is no receive buffer and no interrupt yet, so USART1 holds one byte. Read it before the next arrives, as the Serial example does by polling all the time.

Can I put it on a real chip?

Yes, with a WCH-LinkE programmer on SWIO (PD1): the page of this board in the editor has the Arduino IDE steps and the PlatformIO target. Check anything that uses interrupts or timers first.

Try it on your own firmware

What you build here runs on the board on your desk, unchanged. Nothing to install and no account needed.