We’re in an exciting time for cheap microcontrollers, as with both the rise of RISC-V and the split between ARM and its Chinese subsidiary, a heap of super-cheap and very capable parts are coming to market. Sometimes these cheap chips come with the catch of being difficult to program though, but for one of them the ever-dependable [CNLohr] has brought together his own open-source toolchain. The part in question is the WCH CH32V003, which is a ten-cent RISC-V part that has an impressive array of capabilities. As always though, there’s a snag, in that we’re also told that while supplies are improving this part can be hard to find. The repository is ready for when you can get them again though, and currently also contains some demo work including addressable LED driver code.
As an alternative there’s a comparable and slightly cheaper ARM-based part, the Puya PY32. It’s reckoned to be the cheapest of the flash-based microcontrollers, and like the WCH part is bearing down on the crop of one-time-programmable chips such as the famous and considerably less powerful 3-cent Padauk. This end of the market is certainly heating up a little, and from our point of view this can only mean some exciting projects ahead.
Arduino support for puya py32 would be awesome
I could do that with a 555
/s
555s cost 5-10 times more, need external components that cost as much again, have high power consumption, low operating frequency, poor precision…
You need to buy a special one-wire flasher from WCH, but they released some code to make a flasher out of a CH32F103, we need people to port that code to an STM32 bluepill:
https://twitter.com/patrick_riscv/status/1630134151763357696
https://github.com/openwch/ch32v003/tree/main/CH32V003_1Line_Base_on_CH32F103
WCH use Keil IDE instead of GCC+Makefiles, it could be converted with keil2gcc tool.
See also this article by CNX:
https://www.cnx-software.com/2023/02/22/ch32v003-risc-v-mcu-gets-1-5-development-board-open-source-gcc-toolchain-and-flasher-utility/
They also describe the protocol in a PDF in that Github repository and the commit message links to a YouTube video where they talk about the basics.
I’d be shocked if someone hasn’t written a protocol adapter with an RP2040 yet.
A kit with a dev board, a USB flasher interface board, and 5 bare 20 pin chips, costs $5.51 all up from the WCH store on Ali. Packs of 50 chips cost $5 for 8 pin to $7 for 20 pin. Both go in and out of stock, but are seldom out of stock for more than a few days.
If you could get it to play Doom, it would prove the tool chain is worth it.
embeddedDOOM, which was made by, you guessed it, CNLohr, needs as few as 384kB of RAM. However, this chip contains, as written on the repo :
2kB of RAM
It’s not for today…
External serial RAM to the rescue…?
See here in different form factors:
https://www.aliexpress.com/item/1005005262154401.html
The Puya PY32 seems to be available now. No love with the other chip though.
May have to get a stack of those in TSSOP-20 to see how they perform.
heh i’m a little excited about RISC-V. and of course i love flash microcontrollers. i just feel like there’s not much point quibbling about the cheapest beyond a certain point. at $25 a board like the official stm32 discovery boards, i am gonna be a little bit concerned about price. but once we get down to the price of a raspberry pico rp2040 board, $4, it just doesn’t matter to me…if i need one, i’ll buy 2 more just to have a stock of them. at that price, i feel like i’m paying more for getting an integrated tested supported board from a reputable vendor than i am for the chip itself.
if you’re looking at $4 for a pico board at adafruit vs less than $1 for a bare chip, or worse, $2 for a defective board from aliexpress, i just don’t see it as being all that compelling. even when i was a kid and first started my quest for a flash microcontroller, and found out the DS5000 (battery-backed SRAM!) was $50…if it had been $5 instead, i would have been eager to buy two even just with the $30 i got from installing a modem for someone after school.
obviously if you’re buying a thousand of them for production then you’ll feel totally differently :)
For hobbyists yea, but once you enter mass production, you start caring about fractions of cents.
Didn’t I see that CH32V003 mentioned in the TinyUSB changekog?
Oh, that was the WCH CH32V307. Excuse me
Seem to be available here:
https://www.aliexpress.us/item/3256804850399956.html
999 percent of the time a 555 will do the job had it has been doing for over 50 years
8 cents! I can get a faster, cheaper Chinese clone of this Chinese uC for 0 cents! It even has the WiFi!