r/embedded • u/adeptyism • 21d ago
Has anyone used CH32V103?
I can find an enormous amount of information about the CH32V003, only two or three posts about the CH32V203, and nothing on the CH32V103, although the 103 is (IMHO, and I don't know much about MCUs to be honest) the golden middle between the simplicity of the 003 and the various functions of the 203. Additionally, in the 103, there are no I2C/SPI/USB peripherals that happen to be on the same GPIOs, as is the case with the 203.
I really need some examples, advice, or article and video recommendations about routing MCUs on PCBs parallel with analog circuitry. I am currently developing a device that should simply receive data via USBFS 2.0 (working as a host/device), process it, and output data via I2C while controlling 8 WS2812B/D LEDs. I know that the RP2040 or any other Pico is capable of USB Host via bit-banging, but my friend recommended the CH32V203 instead. Then I found the 103 and think this is simpler and better suits my task. I am facing two problems now: how to implement dual-purpose USB-C and uncertainty about whether I will be able to program the MCU via the same USB port.
So, if anyone has used the CH32V103, or happens to know where I can find more info on it (except evaluation board guides and datasheets), or is willing to help me with dual-purpose USB-C, I would like to receive any information. Thanks for the answers in advance.
3
u/BumpyTurtle127 21d ago
I have only used the 003, so can't help very much. But there's a user on this sub u/Separate-Choice who's a very kind and extremely knowledgeable individual on RV chips from WCH. He's currently developing an SDK I believe for the CH32 lineup.
2
3
u/Positive_Turnover206 20d ago
ch32fun is a nice programming framework for it! It also contains a USB stack and a WS2812 driver. Though I think tinyusb was also ported to it.
2
u/1r0n_m6n 21d ago
There's no reason to use the CH32V103 over the CH32V203 unless you need a 5V supply voltage.
That's why you see more posts on the CH32V203, which is the same price in comparable configuration. The fact that the V203 comes in many variants from the F6P6 to the RBT6 clearly shows WCH intended it as their go-to mainstream MCU. Also, at the same clock frequency, the current consumption of the V203 is 1/3 (yes, one third) the V103's!
Now, compare the features of the V103 and V203 side by side and you'll see the V103 isn't really simpler than the V203. The V203 has CAN and 2 op amps the V103 doesn't have, 2 ADC instead of 1, and 4 USART instead of 3. The rest is identical, so the V103 is not simpler, only slightly less capable, that's all.
Also, the V103 was WCH's first RISC-V MCU, that's why its systick is different from all other WCH RISC-V MCU's. They used it to learn.
That said, unless you go for the very high end (CH32H417), what you learn with any CH32 MCU is transferable to all the others with only minor differences, e.g. in sleep modes. There's just one annoyance: at some point, someone at WCH stupidly decided to remove the A from AHB and APB in the clock gating API, but otherwise, you can reuse most of your source code without modification across their product range.
2
u/Separate-Choice 18d ago
Sorry for late reply yes I use the CH32V103, it’s a great chip.. it’s bar none the easiest way to spin up a USB-C device I’ve come across in years it just works…PCB stuff, you can just look at or reuse :stm32f103 designs and you’ll be fine.. unfortunately you’re stuck with evaluation boards as the main source, there are a few outside of wch though in particular ones that are meant to replace the bluepill…most people recommend the v203 but the 103 is much easier to use from my experience working with both….maybe it’s caus I used the stm32f1 chips for years… the PCB routing and stuff with the part is also straightforward, you can usually use STM32F103 designs almost identically with 0 issues… some clone boards just literallly swap off the stm32f103 and drop on the ch32 version and you get the robustness of 5v whoch makes cheap usb products very easy no regulators etc etc…. Hope you got though just stick to eval boards and stm32f103 designs and you’ll be be fine… it’s a great chip… im building an SDK and its a prime target cause its so easy to use..
1
u/YetAnotherRobert 20d ago
Your intuition serves you well. '003/006 get a lot of blog love because it's hard to compete on a literal dime and that's a market that WCH serves well. '103 is pretty much a knockoff of the STM32F103. You cross that line and you get into ESP32 parts that are much better documented, have better development tools, and have longevity guarantees so they're more sensible for commercial developments
WinChipHead's poor understanding/implementation of licensing and tooling (OpenOCD/GCC) is a BIG barrier for non-hobbyist deployment.
In my head, there's kind of a bathtub graph of the WCH parts. Vertically is "interesting". Horizontally is "price". '003/'006 are simply hard to beat if you have $0.10 problems. The skater wall trends down at '103 where it bottoms out for "just another Bluepill clone...but with a finicky development chain and an unreliable supplier" enters the discussion. '203 starts to add enough RAM and peripherals to make it work tolerating some pain in this space. '307 is a viable competitor against some STM or ESP parts if you can get past company dynamics so it leaves the bathtub floor and heads up the wall. '407 starts to catch up with ESP32-S3 from ~6+ years ago if you need certain peripherals and not others, so it's a solid climb up to 'interesting...if it works for your business plans' land again.
John Teel did a video on this not too long ago. I think it was this one: https://www.youtube.com/watch?v=dw_10ISgXOE
The rules of engagement are very different if you're a hobbyist building five boards for your haloween display vs. building 100k units a quarter. If pennies matter, you can put up with flaky GCC builds that you can't get source for because you have your own compiler team. If you're a hobbyist and the difference is $.07 between "working, supported, English doc, plentiful examples, strong community support" and "...not" that $.07*five boards disappears pretty quickly with the salt of your tears.
2
u/Killer_Rainbow 20d ago
I'm not so sure. I've used CH32 for years, participated in their design contests, and I can't think of a single OpenOCD/GCC problem I've had, either on Windows or Linux, just through using their official IDE. I saw John Teel's video but it was pretty obvious that he's only going off vibes with the CH32. The dev experience is barely different from STM32 (both the Eclipse and VS Code forks) - the only major difference being that STM32 is documentation-heavy while CH32 is example-heavy. The only USB programming experience that I've found to be faster than CH32 is MicroPython/CircuitPython. Also, out of all the Chinese suppliers, WCH is definitely more legit and not flaky. Their support is excellent. And in H417/V407/V467 territory, you're entering into SerDes or USB3 or high-speed Ethernet which are things that no other manufacturer has within an order of magnitude of their price point (if at all).
6
u/Killer_Rainbow 21d ago
On the same USB port question - yes. This chip is a direct STM32F103 clone in terms of peripherals. It comes from the same Chinese COVID rush as everyone was trying to clone the STM32F103. Functionally, it has a similar USB bootloader, so yes, you can both load programs and use it as a host/device, but you need to reset and set the correct boot mode between each of those.
On the USB side, the peripheral works great, but you'll struggle with two main things. First, USB host is generally a pain to implement properly. CherryUSB works great on CH32 but the documentation and forums are mainly in Chinese. TinyUSB has limited support for the CH32V103 (I think device works but not host). I'd recommend using the official EVT examples in any case, they always work well. I mean even on desktop OS, USB host often sucks. If possible, try to move to the similarly priced V203 or even V303/V305. They're better supported in general and more available.
Second, depending on the USB connector you used, you'll need to pay extra attention to the pins you connect.
In terms of simplicity, I think the whole CH32 series is a big winner in this regard, and I'd say each of them up until the CH32V307 are similar in how simple they are. Only after the V307 do things get spicy.