CH32V003 Support

Hello guys, thank you for the awesome library! :smiley: I was wondering if there’s any plan to support the CH32V003 microcontroller. I believe the Arduino core is still at it’s early stages. That said there are other frameworks like CNLohr’s CH32v003fun, and the default IDE: MounRiver Studio. The MCU is very capable and dirt cheap, it can definitely open new possibilities!

Product website: 32-bit general-purpose RISC-V MCU-CH32V003 - NanjingQinhengMicroelectronics
Arduino core: GitHub - openwch/arduino_core_ch32: Core library for CH32duino

Thank you!

Interesting!

I fear the MCU you reference has only 16K flash and 2K ram, I don’t think it will be enough for SimpleFOC. But maybe some of the higher power versions could be supported.

It looks like their timers would be suitable.

A while ago I entertained the idea of using CH32V307, the peripherals seem really great for motor control and it could replace something like STM32G431. But the Arduino core is really underdeveloped for now, so while it’s a nice technical project to use the chips they are still far from “drop in and use”. For example, hardware I2C still does not work on some chips made by WCH, because the silicon is bugged…

Ah right, didn’t really consider the size of the library hah! I wish it had more memory.

Wow damn! Cannot imagine someone breaking their head just to find out the silicon itself is bugged! :open_mouth:

That’s the problem here unfortunately… as a person who has written the low level drivers for several of our supported MCU types, I can tell you that its a tricky and difficult job even when the chips are well tested, the documentation is good, and there are working examples for what you’re trying to do that you can consult for comparison.

For a new architecture with patchy Arduino support, presumably much worse documentation than the “incumbent” MCUs, and few or no examples, it could be a real nightmare.

That’s why I am not super keen to be the first one to embark on this kind of implementation to support Artery, WCH, Geethy or all the other inexpensive MCUs that have been developed recently :wink:
but if someone were to get it working, we’d probably be happy to accept a pull request. :smiley:

1 Like

I think the best chance to use cheap chips under arduino is the GD103 and other STM-compatible clones.
Is the CH32-family compatible with anything?

Doesn’t really look like it. From the docs it would seem to be a RISC-V core combined with STM32 (ARM) like peripherals…

There is an Arduino core, and there are some people at who are working to make the chips more accessible. I think most of the problem is lack of detailed english documentation. I would send you a link to the WCH32 discord but it seems that invites are disabled.

Unlike GD32 the WCH32 parts are not ARM like @runger says so it’s an entirely new toolchain.

I just meant they look STM32-like - the way the timers are named and things like that seems to mirror the STM32 ones… but I didn’t spend much time with the datasheet, so maybe I got a wrong impression…

No, no, I mean you were correct, they are not ARM architecture. Because of this it’s more work for hobbyists to develop tools, at least until the vendor provides something…

1 Like