Checking out the new 10 cent WCH CH32V003 48MHz RISC V processor demo board and the MounRiver Eclipse IDE. Getting to blinky.
The CH32V003 is a pin-for-pin alternative to the STM8S003 at 1/3rd the price, with more features.
http://www.wch-ic.com/products/CH32V003.html
http://www.wch-ic.com/products/categories/47.html?pid=5
https://www.tindie.com/products/adz1122/ch32v003-risc-v-mcu-development-board/
http://www.mounriver.com/download
3 cent Padauk Microcontroller:
https://www.youtube.com/watch?v=VYhAGnsnO7w
Padauk Playlist:
00:00 - WCH CH32V003 RISC V Processor
02:01 - CH32V003F4P6 Eval board
03:00 - Pin-for-pin replacement for the ST STM8S003
04:30 - Datasheet and reference manual
05:24 - MounRiver Eclipse IDE
07:13 - It just worked
10:58 - Open Source GNU RISC V Cross Compiler
11:38 - Download and flash a LED, maybe...
13:51 - Save the file first, dummy.
15:26 - All the includes and headers
17:37 - But can you buy them?
18:11 - How fast can the pin toggle?
Forum: https://www.eevblog.com/forum/blog/eevblog-1524-the-10-cent-risc-v-processor-ch32v003/
Support the EEVblog on:
Patreon: http://www.patreon.com/eevblog
Web Site: http://www.eevblog.com
Other channels:
EEVblog2: http://www.youtube.com/EEVblog2
EEVdiscover: https://www.youtube.com/eevdiscover
T-Shirts: http://teespring.com/stores/eevblog
#ElectronicsCreators #riscv #microcontroller

Hi, it's El Cheapo Microcontroller time again. I've Done Cheap Really cheap microcontrollers before. I've done the Three Cent Paduk Micro Controller. so I'll link that up in here and down below if you want to see that.

Uh Series where I went through actually developing a little Uh project for the Three Cent Paduk Micro Controller. Well got one that's a bit more expensive today. more than three times more expensive, but still only 10 cents. But it is a Risk 5 Micro Uh Controller.

So the new Risk 5 processor, everyone's jumping on board the new Risk Five. It's actually the Risk Five Uh architecture itself is actually just an instruction set and it's open source. So this is why a lot of Manufacturers Uh, if they get an Arm core, for example, they've got to pay a license fee to Arm Corporation. Which means that every cent every microcontroller you buy has that royalty built on top.

Whereas the Risk 5 architecture, everyone's jumping on board because it's royalty free and a lot of Manufacturers including major ones are jumping on board. So the Risk 5 Core is not like a drop-in call that you can get. It's just an instruction set. so manufacturers are free to like, develop their own cores and everything else.

As long as it follows the instruction set, it's a Risk Five Uh, Micro Controller. So we're going to have a look at this one today. Uh, which is from a Chinese company called W C H and they make uh you know they make various microcontrollers to make Cortex M's Now you might have heard about these uh before, like the CHR 500 series. For example, they're like an 805 one.

So this made um all the news back in October last year now which is 2022 so long ago. Uh, this Ch32v 003 is less than 0.1s and this is from Uh Patrick Yang who is the Technical Director at Uh W C H? So I could guess you could give him a follow. um oh look sample purchase LCSC have it I Was gonna say the chip doesn't seem to be available in uh quantity at the moment. This is the only uh downside.

Now here it is. um LCL SC just have the Uh kit I actually ordered my kit on Tindy uh along with the programmer CH link so you can get this for only a couple of bucks. uh more. So that just emulates like it's a Serial um interface uh chip and then you get the demo board like this and uh yeah, it's really, um, cheap as chips.

This particular one, it's the CH uh, 32 v003 F4 P6 it's a 20 pin uh t-sop there's nothing else on there. it's just that because that's a Serial interface. it's next to impossible to get a part number on that, but it's basically uh, just a USB R2 serial interface. So yeah, this little uh demo board is just got, uh, some general purpose I O and uh, it comes with some header pins as well I just soldered the header on the bottom which is the programming interface serial programming interface header.

It's got a one layer to power lead and a reset switch I Think it is. Let's have a squeeze see if we can actually get something running. but all the fuss is that it's a 10 cent Risk 5 microcontroller, right? Fantastic! We'll have a look at the features in a minute, but uh, somebody actually says here over on Y Combinator that it's a drop in replacement for the STM 8s003 value line micro controls that are popular in China at their 20 cent price point. So this halves that price point right? So yeah, it's like it's it's really good, right? it's looking really good.
One we've got on our demo: Ford is the 003 F4 P6 here and what do we get in here? It's a 48 Meg Risk 5 processor, 18 Gpibo roping 16k of flash memory 2K of SRAM so you know it's quite usable. Um, one uart in it one I squared C one SPI It's got an eight channel 10 bit uh ADC how good that is I don't know I haven't really, you know. data sheet linked down below. You can get the specs Phono uh one general purpose uh, timer module one Advanced timer module one system uh tick to watch dogs and uh, partridge in a pear tree? Oh there you go.

It's got an Op-amp bar comparator. It's got sleep and standby modes uh, programmable voltage detector and a 64-bit unique ID that could actually come in handy like a laser trimmed. ID on the theme. that's pretty groovy and it's available in different packages.

So we've got the F4 P6 which is, uh, the T-sop 20 here and down here. It seems like the resources that we've got are the data sheet and then a application. uh, manual. So here you go.

Here's the data sheet there, but I won't go through. uh, the details, but you know it's it's quite. uh, comprehensive. Then you've also got the reference manual as well, which is instrumental in telling you how it actually works and stuff like that.

and that is. Yeah, that is very comprehensive. How many pages? 181 pages long? So that's how to drive all the registers and everything else to get everything. Uh, set up? So yeah, it's it.

Looks as good as any. Um, you know, mainstream. um mainstream processor. So excellent.

that's off. And then they've got a idea as well, which is called moan River I thought it was Moon River When I first said it, it's Moon River Studios Mrs and if you go to Moon River and it looks like it's it's just for this. the risk 5. Oh, it does arm MCU so it's just basically I think it's their own um thing against the backdrop of a round sky and a round Place eye-catching yellow and white lines.

What? Anyway, it's based on the eclipse uh gnu which is the free open source development uh environment. So I downloaded that and I installed it and ran it. Let's take a look see how quickly we can get something running now. I've actually, um, spared you the 15 or 20 minutes it took me to actually, uh, figure out this thing.

Um, but anyway, there are no drivers for the program up for it I just plugged it in. It appears as a Com3 serial Port there. you can see that in my device manager down there wch link. uh, cereal.
although I haven't got the serial console thing working yet, but it just appears the serial thought that's how it programs it and presumably you can get serial back out of it as well. So you'll have to forgive me. I haven't used Eclipse since a Galaxy far far away. so this is me as an eclipsa IDE dummy and also as a Risk Five dummy as well because I haven't used a Risk 5 processor before.

So how quickly can I get something up and running? well? all I did is I actually opened uh one of the projects here. they they give you a couple of zip files I just unzipped everything and they've got. We can go right in here like this, but we'll go into here EVT and then examples I don't know what Pub is. haven't had a look yet, but we get our examples for ADC um stuff dma So yeah, flash I actually did the flash one first thinking it was flashing the lead I thought it was the you know the lead flasher example.

it's not. um anyway the Gpio one which we're going to play with now I squared C uh iaap the Watchdog Opa that'd be the Op amp would it power like low power power mode Examples: Spy Bus system Tech Timer modules you start Watchdog so it's got all the you know the examples of all the internal peripherals. Excellent. So anyway I just selected the Gpio over here.

Now it just worked. It just worked. I Simply installed the Gpio uh, toggle thing here. okay and includes all the you know it's got all the includes and everything and we can go through like there's a whole whole bunch of them right? But here is the main dot C so it's done by WC hey if they include debug H and you know it's got a few extra things.

Um, we gpio init uh structure. We set up uh the pin. Here we set up the mode we it looks like you can change the Gpio speed. that'd be like a slew rate.

uh thing. probably that'd be my guess. Once again, have not looked into the details I'm just in this video. we're just looking to see how easy it is to get something running.

Here's the main program here. now. it does actually do a printf Um so it's print F to the console I Haven't been able to actually get that printf out yet on my serial terminal program or in a console. Um, thing here.

Yeah, so all it's doing is calling Gpio toggling it up here. which is this routine up here which just sets the output uh, pins. You know it. It looks a little bit complicated to set up the I O, but this is what you expect in any uh, micro, uh controller.

So the peripheral clock command I don't know I don't know what's going on there. Once again, you'd have to. they're enabling something there and that's to do with the Gpio. D They do have different.

Here's the actual pin out here and the T-sop20 is the one we want to look at. So the second uh column there. these are all the pins. So they have a PD and it looks like P A So like port A and Port D and Port C as well.
So we're actually dealing with P D here. Port D Yeah, so that's why they're setting up by Gpio D there and then yeah, all they're doing is then using the built-in Gpio right function which they are Supply and then they've just got a millisecond delay in there for 250 milliseconds and then they're just, uh toggling uh, Gpio pin zero there and I Sure enough, like if you just go up to flash like this once again, I didn't install any drivers I didn't I didn't even set it up in the eclipse uh software I just went download and it's it's flashed it. it's actually flashed the chip and sure enough, if you disconnected it says error and everything else right? But the thing I spent 10 15 minutes are trying to uh, figure out is not only does it have seem to have the wrong PIN Um, because I was trying to flash the lid on here and I'll show you that in a minute I do actually have. you can see it, the lead's actually flashing there.

Okay, I do actually have a lead flasher but it didn't work straight away because and one a thing that seems to be here even right if I go to project and I build it. Okay, this is the because: I've actually already modified this code to make it work. but if I just go build all like that. Okay, well it's building.

it's building. it's building. it will actually now do it. Okay, it's generated the Gpio hex file down here.

but if I just change something and this is probably an Eclipse thing. if I actually change something in here and just did build, it would not actually regenerate the hex file. Yeah! I Went I spent 10 15 minutes trying to figure out that it had the wrong hex file on there. When I changed the code here, it wouldn't do it.

but we can actually go in there and we can project. and we can actually clean the entire project Which it and then it just gets rid of like all the stuff. So we've got like an absolute clean build like that so we can go through. Here's all here here.

It is here. It is right. It's going through all the compiler stuff I can actually show you more of this, right? And it's using the uh, Gnu Risk Five C cross compiler. So it's not specific to Wch, it's just using the the regular free Gnu Risk um, the Five cross compile C cross compiler here.

But of course Wch provide all the includes and everything else. This is what the manufacturers have to do for their particular core uh configuration. So building all that, it's doing the debug. It's including the peripheral staff for the use sart because we're doing a printf.

so they're invoking the C Linker here and they're generating um. Gpio toggle hex. It's all done now Flash Download this, it's not going to flash anymore and then here we go I'll prove it. only silly me actually.

um, mixed up one of the Uh data lines here and I I was probing the wrong thing so that you know I used to spend a few like 10 15 minutes actually trying to, uh, solve that. But anyway, if we probe d0 here, that's about 250 milliseconds. let me that's 50. That's 100 now 100 milliseconds per division.
There you go, and ground leads just flapping around in the breeze there. That's why we've got our um, we're just using the PC serial ground. So yeah, we're picking up all that crap. But yeah, good enough for Australia There you go.

It works and it just like like it worked out of the box like it didn't have to install any drivers for this. I didn't have to even select the programmer over here I just installed the thing I went Flash download. uh the only issue I had was you know, like a clean build to just make sure it generated. uh the new hex and stuff and it worked just fine.

So anyway and let's see if we can Flash that lead. okay I'll show you how I got the lead to flash Why they don't do like make the lead Flash and just call it a lead flasher I Don't know why they chose pins zero there because the lead is not connected to pin zero. If we go over here and have a squares, you can see that the leads dropping through that via there it's going over there. it's actually on D4 So yeah, so what we're gonna do here and we're gonna go pin four once again.

I Did all this without reading uh, the manual, the data sheets. nothing I Just like not knowing anything about this I Just went in there. Yeah, that's obvious. Okay, we need to initialize our pin for or here and we need to go and toggle pin 4 down the bottom here.

and once again, I'll do a clean build of that because I'm still not familiar with this interface build. So it generates a new hex file and normally it's not this long. Normally it'll It'll do it in under a second as you are soar back at the beginning there. But there you go.

you can just dump this. Flash download. Maybe you can get it to download automatically. Not sure, but done.

Why is it not flashing? It's not flashing? All right. This might be the eclipse thing again, but I might actually have to save the file first. I think I think you've got to save it. It won't take it from memory, so please leave it in the comments down below.

If that's just a little, you do. Dave Of course that's an eclipse thing I think I forgot to save that. So let's actually rebuild that and we'll see if uh, it should work now. I'm pretty confident that's when you come a gutter.

Okay, there we go. It's definitely generated the toggle hex, but it's based on the new the saved file. So we'll simply flash that download and ah ah, can see it. it's flashing.

There you go. 250 milliseconds flash rate. We can actually go back here. Let's let's modify that to what I had before: 50.

So I'll go. file save can I just actually can I just do the uh, just just do the build all again. No, that was faster that time. So I didn't have to do a clean build.
Looks like it's generated the hex. Let's download that so the key is saving if you're modifying your code and bingo Yeah there it is Flash faster rate 50 milliseconds there you go. Brilliant! So that actually works an absolute treat. And if we want to see that printf stuff here, then we can just go into the output console here and Com3 connected and there it is.

um, system clock 48. you know, because it ran it twice. so that's why it displayed it uh, twice. and GPI toggle test.

So I can have a look at all the like include uh stuff. So there you go. There's all the peripheral access layer source file, right? So all you aficionados in there right can get all moist about that. There's all the header stuff, right? So this is actually defining that would be defining all the pins and stuff, what it registers and all sorts of things in the Risk Five architecture here, right? So and then it's got debug, um, stuff as well because you can do uh, real-time debugging.

Let me know if you wanted me to do future videos on actually using this more. But here's the peripheral stuff so we can go into. Here's the ADC stuff and down here we have like their header file so these actually you know you know these are headers for defining all the commands which you can do. There's our Gpio stuff.

So here's all the um, right Gpio pin zero so they're all defined. you can Define All and then these are the different you can you can read right, reset bits right? So that's where you can get all that info from even without reading the manual right. This tells you what you need to do. Um so yeah, this is pretty good.

I Don't think there's a document for like a demo, a startup like get into Blinky or something like you know I Don't think there's a uh, there might be leave it in the comments down below. but I I didn't need a plugged in download. Gpio Toggle figured out a few things with the Eclipse interface. Bob's your uncle right? So here's all the peripheral stuff so you can get the source stuff.

So here's the actual uh routines for the Gpio, right? So here's here's where they're doing it. So yeah, and then there's some system stuff over here. so you know you define your system uh, frequency here for example, like it's got different internal clocks like you can Define Eight megahertz. and yeah, it looks like it's got 8, 24, and 48 internal.

It's probably got a low frequency clock as well I'd assume because it's got like low power modes doesn't or is that just uh, standby modes once again, haven't looked at the data sheet, but all I wanted to do is see if this is legit or not if I can actually use their IDE which is the Eclipse IDE which is totally legit and they've just got all the stuff and it just worked. So I am very happy with that. That gets a thumbs up. Well done.

Unfortunately it looks like at this exact time you can't actually buy the chips. but I guess they're coming. They don't say what the quantity breakdown is for the 10 cents you probably have to order. you know, in in the thousands of.
But the risk? Five Microcontroller 48 Meg for 10 cents. Not too shabby at all. It's like yeah, that's a winner winner chicken dinner. It's worth checking out.

It just gives you another uh tool another option in your development. Uh toolkit. I Highly recommend getting one and just having a play around with it if you ever need a you know, really cheap, but you know, reasonably powerful 48 Meg is uh, not too shabby. Let me know if you want me to do follow-ups I can do like a a toggle to see how fast it toggles and uh so I could do that right now so we'll comment out the delay there and we'll see how fast it actually toggles Once again, you could probably get it faster using assembler so let's just see how fast it goes.

Just off the bat, um using you know, plain vanilla sea. almost a Meg that's not too far. She could probably get faster if you did. Uh, the Risk Five, uh assembly? I'm sure you can because I have seen somewhere in here I'm sure I saw uh Risk 5 Assembly see if I can find it so that looks like uh, Risk Five Assembler that that's assembler for all the money.

So there you have it. Uh, that's the Chr32 and we got to Blinky with that and uh, no, yeah, essentially like straight out of the box. So hats off to W C H. I'm looking forward to be able to like buy this on LCSC or you know the Holy Grail is to get it on digikey or something like that.

but they typically don't carry like these. um Chinese uh. specific manufacturers. Or you know, even if you buy it directly from the website, don't know why you can't buy a reel.

By the way, you can actually go down here and you can sample and they want to. You know it's the usual thing, company name and stuff like that annual consumption. So yeah, I like that. I'm going to add that to my uh design toolkit.

I can use Risk 5 processors no workers. um and it's probably just as easy to. You know we've got the examples for all of the peripherals in here, so I'm sure they'll work uh just as well and that's the best way to learn is to okay I need to read a value from the ADC For example, you load up the ADC example. You know you can just see how that all works.

You can play around with it and then you can include that anyway. Thoughts and comments: Down Below on this new 10 cent risk 5 processor. Catch you next time.

Avatar photo

By YTB

23 thoughts on “Eevblog 1524 – the 10 cent risc v processor! ch32v003”
  1. Avataaar/Circle Created with python_avatars Space Reptile says:

    cant wait to see a few projects actually using this MC, some practical applications instead of just flashing an led as thats pretty boring and does not really sell me on this over any other MC

  2. Avataaar/Circle Created with python_avatars Spacewolf Jr. says:

    Moooooun river, wider than a nanometre
    I'm crossing you in style some day
    Oh, DRAM maker, you heart breaker
    Wherever you're goin', I'm polarized your way

  3. Avataaar/Circle Created with python_avatars Kattz says:

    Im pretty sure that these are on Ali Express. They were $2-3 Canadian, which is still an unbelievable price. I bought myself a box of microcontrollers to have something to do over the winter. These look like they are better documented than some of the LilyGo devices that I bought.They were a lot more than a couple of dollars.

  4. Avataaar/Circle Created with python_avatars Yisrael Dov L says:

    Luh Duh dave!

  5. Avataaar/Circle Created with python_avatars David T says:

    Trust the toolchain?

  6. Avataaar/Circle Created with python_avatars Vic Mac says:

    Would this be enough to feed a diy keyboard? If the video has answercI didn't finish it yet..

  7. Avataaar/Circle Created with python_avatars YES! Oジージャン says:

    Real single wire debug interface like STM8S. But HAL lib uses too much FLASH. Hope WCH could release register type library.

  8. Avataaar/Circle Created with python_avatars magfal says:

    My new soldering iron is running a Risc-V CPU.

  9. Avataaar/Circle Created with python_avatars Krzysztof Daszuta says:

    Now we need Rust toolchain for this IC and I would call it a day 🙂

  10. Avataaar/Circle Created with python_avatars MisterkeTube says:

    Low-power-modes?

  11. Avataaar/Circle Created with python_avatars Adam Bryant says:

    thanks for highlighting it and where to find it.

  12. Avataaar/Circle Created with python_avatars Mark Warburton says:

    I'd love to see how good (or bad) the ADC is. There are some absolutely brain-dead examples of ADC uC implementations (be that design, software implementation or hardware). I reckon you can tell a lot about build quality by how well or poorly the ADC performs because it's one of the hardest things to implement with good results.

  13. Avataaar/Circle Created with python_avatars Shane Johns says:

    Assembly isn't too bad. It's processor-dependent, so you have to learn it for every kind of chip for which you're programming. My university had it pretty early in the curriculum, I think sophomore year or earlier. And we learned on a DEC VAX. Given the reduced instruction set of RISC, it's expected that you will have to do more work at the coding level anyhow — but usually mostly through loops of some complexity or another. If you know how the newer chips do a routine, you can usually pretty much figure out how to code it – but code optimization is extra-important in such low-level RISC libraries. Back in the day, the selling point was that the chip could essentially run a bit faster because it couldn't do as many things. But looking at that paltry 48 MHz clock speed, I'd say it is more of a miniaturization benefit, and all that comes from that (half as far goes twice as fast, even for electricity…). Even with the benefits of assembly, that 2K of SRAM seems extremely cramped, IMHO. But it's best to get people accustomed to working in that sort of constrained environment, and then see their eyes light up when they double it to 4K of SRAM. This is the sort of chip I would want running the AI auto-defense system of my tank, to protect it from RPGs… Simple (fits within 2K) repetitive looping tasks…

  14. Avataaar/Circle Created with python_avatars N0mad Fernan says:

    hope many manufacturers move on to this cheaper hardware. thank you dave for showcasing this. might as well jump to this risc-v bandwagon if it becomes easily available for cheap

  15. Avataaar/Circle Created with python_avatars Shane Johns says:

    64-bit chip unique ID… Wow… So every one of these things is incrementally different where it comes to the unique ID. I'm imagining little assassin mosquito drones running with these super-tiny RISC chips in them… Forgive me, but I just spent the last half hour watching drone videos from Ukraine… I wonder how much of that physical package is actually the chip inside? I suspect that it's significantly artificially larger than it COULD be, just to make it compatible with circuit board designs. Has anyone made a laser layer-by-layer etching video of one of these packages to see how large the silicon is?

  16. Avataaar/Circle Created with python_avatars der.Schtefan says:

    I hate Eclipse since the 90s because of quirks like that. "Save before build" is an option that is OFF by default.

  17. Avataaar/Circle Created with python_avatars ドイティンガークリスティアン says:

    They have a Linux Version 😀

  18. Avataaar/Circle Created with python_avatars 1dfgaJ83K92 says:

    So if you want to make a product with one with their code are there any license fees involved?

  19. Avataaar/Circle Created with python_avatars t1d100 says:

    Cool.

  20. Avataaar/Circle Created with python_avatars Rob Cosentino says:

    Sooooo, download the IDE, plug in the RISC V Processor to the programer, flash it, and… Bob's your Uncle!!! 💪

  21. Avataaar/Circle Created with python_avatars K K says:

    Are we seeing a new Arduino 🤩?

  22. Avataaar/Circle Created with python_avatars Glen Hinckley says:

    save before build is an option

  23. Avataaar/Circle Created with python_avatars Andy Grace says:

    Love the innovation in RISC V but it's a bit more complicated.  

    Sure the instruction set is open source and there are virtual cores online to download and chuck into an FPGA, but the problem is it still requires a licence fee if you want to use one of the well developed ones for a real piece of hardware. Most people use a core from SiFive or similar who've done an incredible amount of good work. Now Intel is behind it, it's going to be interesting. Of course it takes a LOT of engineering to optimise a completely new processor whatever the instruction set, so unless you have a massive budget the options are currently a bit limited.

    The cost isn't much different from using ARM at their lowest tier pricing. ARM is of course amazingly mature with advanced compilers, reference designs, debuggers and so on. One of the reasons ARM is much cheaper than it used to be, is due to the long term threat from RISC V; competition is a great thing.  

    If the Nvidia purchase of ARM Ltd had gone ahead, there would have been an urgent need for many vendors to hedge their bets and rush into RISC V. Now that's been blocked by the European regulators, it's less critical, but still a very active area right now. Microcontrollers offer the most upside right now, rather than servers and desktops although they are beginning to trickle out too.

Leave a Reply

Your email address will not be published. Required fields are marked *