Author Topic: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003  (Read 21644 times)

0 Members and 1 Guest are viewing this topic.

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« on: January 16, 2023, 09:49:16 pm »
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

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?

 
The following users thanked this post: thm_w, RoGeorge

Offline LovelyA72

  • Regular Contributor
  • *
  • Posts: 60
  • Country: us
  • Kashikoma from Massachusetts!
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #1 on: January 16, 2023, 10:18:49 pm »
WCH makes really impressive ICs. I ordered some CH32V003 and CH32V203 from AliExpress and they are quite fun to work with.

The only issue is that their openocd is not open source. You need to email them to get the source code(which I did, they replied me within an hour with buildable full source code of their modified openocd).
Kashikoma!
 
The following users thanked this post: EEVblog

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #2 on: January 16, 2023, 11:24:51 pm »
The only issue is that their openocd is not open source. You need to email them to get the source code(which I did, they replied me within an hour with buildable full source code of their modified openocd).

Nice.
Are you now under some sort of license with having that code?
I'm not sure I get what's happening here. If they are willing to just give you the code, that's almost implied open source. And is it built on open source software and they aren't honoring a carry forward license of something?
 

Offline vlad777

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: 00
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #3 on: January 16, 2023, 11:48:10 pm »
I don't see anything about the opamp (OPA) in the datasheet.
No OPA section , nothing in the ADC section or in TIM2 section.

In a datasheet for another part there is some info in ADC section like PGA[1:0]
(ADC channel gain configuration:
00: x1;
01: x4;
10: x16;
11: x64.
Note: The input gain can be configured, for amplifying
small signals and sampling.)
Mind over matter. Pain over mind. Boss over pain.
-------------------------
 
The following users thanked this post: EEVblog

Online thm_w

  • Super Contributor
  • ***
  • Posts: 6352
  • Country: ca
  • Non-expert
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #4 on: January 17, 2023, 12:05:15 am »
I don't see anything about the opamp (OPA) in the datasheet.
No OPA section , nothing in the ADC section or in TIM2 section.

Its right in the link Dave posted: http://www.wch-ic.com/products/CH32V003.html
Bunch of stuff in the Datasheet as well.
But this seems like a basic datasheet, the reference manual is somewhere else, maybe you are looking at that?

Quote
1.4.15 Operational amplifier/comparator (OPA)
The product has built-in 1 group of operational amplifiers/comparators, and the internal selection is linked to
the ADC and TIM2 peripherals. Its input and output can be selected by changing the configuration to select
multiple channels. It supports to amplify the external analog small signal and send it to the ADC to realize the
small signal ADC conversion. It can also complete the signal comparator function. The comparison result is
output by GPIO or directly connected to the input channel of TIMx.
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #5 on: January 17, 2023, 12:17:33 am »
The chips haven't turned up on LCSC yet, but people in other threads on EEVblog forum have been able to buy 1000 chips at the advertised price (10c is for the 8 pin version, the 20 pin is 12.5c) by emailing WCH directly.

Note that the dev board kit also comes with 5 bare chips.

The 3c Padauk is a OTP part -- these are FLASH. You can get the Padauk in a flash version for prototyping but it's a lot more pricey. And it's still a horrid PIC clone 8 bit ISA.

Lots of information in this thread, started October 31: https://www.eevblog.com/forum/microcontrollers/wch-$0-10-risc-v-mcu/
« Last Edit: January 17, 2023, 12:29:32 am by brucehoult »
 
The following users thanked this post: EEVblog

Offline vlad777

  • Frequent Contributor
  • **
  • Posts: 350
  • Country: 00
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #6 on: January 17, 2023, 12:31:53 am »
I don't see anything about the opamp (OPA) in the datasheet.
No OPA section , nothing in the ADC section or in TIM2 section.

Its right in the link Dave posted: http://www.wch-ic.com/products/CH32V003.html
Bunch of stuff in the Datasheet as well.
But this seems like a basic datasheet, the reference manual is somewhere else, maybe you are looking at that?

Quote
1.4.15 Operational amplifier/comparator (OPA)
The product has built-in 1 group of operational amplifiers/comparators, and the internal selection is linked to
the ADC and TIM2 peripherals. Its input and output can be selected by changing the configuration to select
multiple channels. It supports to amplify the external analog small signal and send it to the ADC to realize the
small signal ADC conversion. It can also complete the signal comparator function. The comparison result is
output by GPIO or directly connected to the input channel of TIMx.

17.2.1 Configuring the extended control register (EXTEND_CTR)

OPA_PSEL
OPA_NSEL
OPA_EN

One register that basicly tells you how to turn it on and off.

I was hoping for gain selection.

I admit , i didn't use opamps in uC before, but that is why i am interested.
Mind over matter. Pain over mind. Boss over pain.
-------------------------
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #7 on: January 17, 2023, 12:51:40 am »
I don't see anything about the opamp (OPA) in the datasheet.
No OPA section , nothing in the ADC section or in TIM2 section.

Yikes, i didn't look that close.
 

Offline LovelyA72

  • Regular Contributor
  • *
  • Posts: 60
  • Country: us
  • Kashikoma from Massachusetts!
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #8 on: January 17, 2023, 01:08:31 am »
The only issue is that their openocd is not open source. You need to email them to get the source code(which I did, they replied me within an hour with buildable full source code of their modified openocd).

Nice.
Are you now under some sort of license with having that code?
They are willing to give you their code which are licensed under the GPL license. There is no other legal agreement between you and WCH. You just need to ask them for it. It's just bizarre that they are willing to give out codes upon request but not having a live GitHub repository which can save them so much precious FAE times.
« Last Edit: January 17, 2023, 01:12:12 am by LovelyA72 »
Kashikoma!
 
The following users thanked this post: EEVblog

Offline LovelyA72

  • Regular Contributor
  • *
  • Posts: 60
  • Country: us
  • Kashikoma from Massachusetts!
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #9 on: January 17, 2023, 01:16:01 am »
Their fork of openocd is really the key of having a fully functional Arduino core. Everything else are either open source or off the shelf. I guess it's fine to ask them for their source code every time there's an update, it just annoying.
« Last Edit: January 17, 2023, 01:18:00 am by LovelyA72 »
Kashikoma!
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #10 on: January 17, 2023, 01:31:22 am »
What do you mean here by "Arduino"?
 

Offline kaweksl

  • Contributor
  • Posts: 18
  • Country: pl
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #11 on: January 17, 2023, 01:58:09 am »
I have played with that chip lately. Good thing is that SDK mostly works, compiler and debugger with breakpoints.

In debug i didn't had any peripherals registers. despite there was svd file. I had to install embsys plugin for eclipse and load that svd.

Some demos are very basic, and sometimes not working. for me i2c demo didn't work. After some digging turns out that registers are not being setup correctly ( FREQ bits in I2C1_CTLR2 register are set outside allowed range) .
 

Online thm_w

  • Super Contributor
  • ***
  • Posts: 6352
  • Country: ca
  • Non-expert
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #12 on: January 17, 2023, 02:08:50 am »
17.2.1 Configuring the extended control register (EXTEND_CTR)
OPA_PSEL
OPA_NSEL
OPA_EN

One register that basicly tells you how to turn it on and off.
I was hoping for gain selection.
I admit , i didn't use opamps in uC before, but that is why i am interested.

Yes that is how it works in a simple implementation like this. You have the OPAMP available on external pins, then you can use resistors to set gain/etc. For those designs that might use one OP to amplify a thermocouple, or some other static task. Might save a few cents.

Higher end micros will have more configurable opamps, and if they have gain settings they will generally call it PGA:
https://www.st.com/resource/en/application_note/an5306-operational-amplifier-opamp-usage-in-stm32g4-series-stmicroelectronics.pdf
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #13 on: January 17, 2023, 02:13:07 am »
The only issue is that their openocd is not open source. You need to email them to get the source code(which I did, they replied me within an hour with buildable full source code of their modified openocd).

Nice.
Are you now under some sort of license with having that code?
They are willing to give you their code which are licensed under the GPL license. There is no other legal agreement between you and WCH. You just need to ask them for it. It's just bizarre that they are willing to give out codes upon request but not having a live GitHub repository which can save them so much precious FAE times.

So you can just take it all and github it for everyone. Only issue is it gets out of date and would essentially be a fork from their version.
But that means someoen can just take it and turn it into a fully community maintained toolchain.
 

Offline LovelyA72

  • Regular Contributor
  • *
  • Posts: 60
  • Country: us
  • Kashikoma from Massachusetts!
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #14 on: January 17, 2023, 06:58:02 am »
The only issue is that their openocd is not open source. You need to email them to get the source code(which I did, they replied me within an hour with buildable full source code of their modified openocd).

Nice.
Are you now under some sort of license with having that code?
They are willing to give you their code which are licensed under the GPL license. There is no other legal agreement between you and WCH. You just need to ask them for it. It's just bizarre that they are willing to give out codes upon request but not having a live GitHub repository which can save them so much precious FAE times.

So you can just take it all and github it for everyone. Only issue is it gets out of date and would essentially be a fork from their version.
But that means someoen can just take it and turn it into a fully community maintained toolchain.
Some folks are already doing this! https://github.com/Seneral/riscv-openocd-wch

I really hope we can have a community maintained WCH OpenOCD.
Kashikoma!
 
The following users thanked this post: EEVblog

Offline StuartM

  • Newbie
  • Posts: 1
  • Country: au
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #15 on: January 19, 2023, 06:09:45 am »
It'll be interesting to see if the makers of the HC-12 433MHz Wireless module update the design to use this chip instead. Original chip is the STM8S003. The only difference is the STM8S has a VCAP pin that needs a cap connected, whereas the CH32V003 uses that pin as a GPIO.
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #16 on: January 19, 2023, 07:03:22 am »
It'll be interesting to see if the makers of the HC-12 433MHz Wireless module update the design to use this chip instead. Original chip is the STM8S003. The only difference is the STM8S has a VCAP pin that needs a cap connected, whereas the CH32V003 uses that pin as a GPIO.

If I was making a volume product based on the STM8S003 then I'd certainly be looking at the economics of replacing it.
 

Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14181
  • Country: de
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #17 on: January 19, 2023, 08:48:27 am »
The periphery seems to be a near copy of the STM8S... , so a replacement of that chip as a possible market.  It still depends on the volume if it is worth the effort for new firmware (it may still need more than just a recompile, especially if ASM or delay from code run time is used with the STM8) and new EMI tests. Besides the costs the availablity could be an issue - currently for both the STM and WCH parts.

Another point could be erratas that may still have to come up.
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #18 on: January 19, 2023, 10:09:29 am »
The periphery seems to be a near copy of the STM8S... , so a replacement of that chip as a possible market.  It still depends on the volume if it is worth the effort for new firmware (it may still need more than just a recompile, especially if ASM or delay from code run time is used with the STM8) and new EMI tests. Besides the costs the availablity could be an issue - currently for both the STM and WCH parts.

Yes, the econonimcs of it includes the NRE required for the software redesign and software/hardware testing, factoring in availability.
Good to know you have the option though if the ST supply chain breaks down again.
 

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4766
  • Country: nr
  • It's important to try new things..
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #19 on: January 19, 2023, 11:04:13 am »
The wch-link usb-serial serial dwnloader does not seem to be a straight tx/rx serial as you said.. Much more like the st-link, even though it shows as a comX, probably made of a ch32v chip with a fw in it. You said the printf did not work - did you try via ft232 something or with the wch-link?
 

Online thm_w

  • Super Contributor
  • ***
  • Posts: 6352
  • Country: ca
  • Non-expert
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #20 on: January 19, 2023, 10:30:34 pm »
The wch-link usb-serial serial dwnloader does not seem to be a straight tx/rx serial as you said.. Much more like the st-link, even though it shows as a comX, probably made of a ch32v chip with a fw in it. You said the printf did not work - did you try via ft232 something or with the wch-link?

quote from youtube (tmx): "WCH-LinkE is not a generic USB to serial interface. It is a CH32V305 microcontroller implementing the single wire debug protocol used on the V003. Yes, technically that is serial, but it isn’t just a pass through buffer."

Watch to the end of the video, printf worked.
« Last Edit: January 19, 2023, 10:32:19 pm by thm_w »
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #21 on: January 19, 2023, 10:46:18 pm »
The wch-link usb-serial serial dwnloader does not seem to be a straight tx/rx serial as you said.. Much more like the st-link, even though it shows as a comX, probably made of a ch32v chip with a fw in it. You said the printf did not work - did you try via ft232 something or with the wch-link?

The printf worked fine inside Eclipse, it was just a a bit dodgy in how it worked at first.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #22 on: January 19, 2023, 10:58:39 pm »
The dev board (including USB interface board and 5 bare 20 pin chips) is back in stock at the official WCH store on Ali. US$5.51 plus shipping (which was US$6.69 to New Zealand when I bought one in November)

https://www.aliexpress.us/item/3256804709476544.html
 
The following users thanked this post: OZ1LQB

Offline iMo

  • Super Contributor
  • ***
  • Posts: 4766
  • Country: nr
  • It's important to try new things..
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #23 on: January 20, 2023, 12:03:01 am »
The wch-link usb-serial serial dwnloader does not seem to be a straight tx/rx serial as you said.. Much more like the st-link, even though it shows as a comX, probably made of a ch32v chip with a fw in it. You said the printf did not work - did you try via ft232 something or with the wch-link?

quote from youtube (tmx): "WCH-LinkE is not a generic USB to serial interface. It is a CH32V305 microcontroller implementing the single wire debug protocol used on the V003. Yes, technically that is serial, but it isn’t just a pass through buffer."

Watch to the end of the video, printf worked.
Ok, re serial - I heard it at 2:42.. Great printf works..
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #24 on: January 20, 2023, 12:08:54 am »
Ok, re serial - I heard it at 2:42.. Great printf works..

Yes, I forgot to edit that part out.
 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1055
  • Country: ca
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #25 on: January 20, 2023, 06:53:51 pm »
The dev board (including USB interface board and 5 bare 20 pin chips) is back in stock at the official WCH store on Ali. US$5.51 plus shipping (which was US$6.69 to New Zealand when I bought one in November)

https://www.aliexpress.us/item/3256804709476544.html

I just bought a bag of 50 bare chips tsop 20 on Jan 16 (the last unit -sorry guys) from the official WCH aliexpress store. So they are becoming available in fits and bursts.
 

Offline rhodges

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #26 on: January 23, 2023, 06:57:19 pm »
I just ordered the two-board kit and 50 each of 20 and 8 pin chips an Aliexpress. Combined shipping was $15, for $40 total.

I got the datasheet and reference manual, but does anyone know where to find the errata?

Now I am reading the Risc-V specification. I really like the commentary on how and why decisions were made.
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #27 on: January 23, 2023, 10:03:55 pm »
I just bought a bag of 50 bare chips tsop 20 on Jan 16 (the last unit -sorry guys) from the official WCH aliexpress store. So they are becoming available in fits and bursts.

You can apparently order large quantity if you contact them direct.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #28 on: January 23, 2023, 11:19:45 pm »
Now I am reading the Risc-V specification. I really like the commentary on how and why decisions were made.

An interesting point that is kind of implied but not made explicit is that RISC-V was originally designed as a 64 bit ISA, with the 32 bit version a bit of an afterthought.

Cutting it down to a version with only 16 registers was definitely a very late afterthought, basically along the lines of "some people are going to do this anyway, so we might as well standardise it". A 64 bit ISA with 16 registers (RV64E) was definitively ruled out for a long time, but now opinion is moving to "No, that's actually useful for a small control core on an otherwise 64 bit SoC ... and it's easier to allow it than to forbid it".

The C extension for 2-byte instructions was optimised around SPEC, including giving SPECfp a high weighting, so it's not really ideal for microcontrollers, and in particular Thumb2 code ends up a bit more dense. Recent RISC-V standard extensions such as Zb* ("B") and Zc* seem to have closed the gap, or even reversed it.

RV32E code also ends up less dense than RV32I because it's more often necessary to spill values from registers to the stack.

Still, 8051 and PIC and so forth are hardly ideal ISAs. The benefits of a 32 bit ISA designed from the start to support high level languages such as C are pretty large, as are leveraging compiler and other software work from bigger machines. And, of course, the benefit of anyone with a bright idea for a new CPU core (bigger or smaller) being able to just use the ISA and everything around it without having to get permission from ARM or Intel or anyone else.

A lot of people say "Why do you need zero license fee, when ARM's fees are so reasonable?" But that's not the point. Permission and contracts and contract disputes are the far bigger point. Just ask Qualcomm and Nuvia.
 

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #29 on: January 24, 2023, 03:22:59 am »
A lot of people say "Why do you need zero license fee, when ARM's fees are so reasonable?" But that's not the point. Permission and contracts and contract disputes are the far bigger point. Just ask Qualcomm and Nuvia.

Even saving one cent per chip can matter.
Building a million widgets, each 1 cent saving is $10k extra profit
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #30 on: January 24, 2023, 03:58:57 am »
Yes, but it involves developing your own core. RISC-V is just an ISA. ARM sells cores, not an ISA. Kinda big difference.
And from what I've seen, licensing fees from the current major sellers of RISC-V cores are not really cheaper than ARM's. Often the opposite (which is understandable though due to scale factor that ARM has had for a long time now.)

Sure you can always go from an open-source core and build around that, but that's still significant work, no support and the open-source license attached to the one you pick must fit your business model.
All this is very far from just picking an ARM core, paying a fee and pretty much calling it day, for the most part.

So the comparison must be made with all factors taken into account. This works if you're a big company selling millions of devices indeed, with the cash to invest in significant R&D to develop your own silicon. That's not for the small (or even medium-size) company. For those chinese companies selling ultra-low-cost chips by tens of millions, RISC-V is sure a fantastic opportunity.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #31 on: January 24, 2023, 06:00:53 am »
Sure you can always go from an open-source core and build around that, but that's still significant work, no support

While there are probably hundreds of RISC-V cores on github that were created by someone in a weekend and (maybe) tested on an FPGA, there are also a significant number that are of demonstrably very high quality and have been proven in silicon many times.

Obvious examples include Berkeley Rocket and the Pulp Platform (ETH Zurich & University of Bologna) cores now known as CV32E40P, CVA6, Ibex. If you're not prepared to invest $10m in core design then don't even think about making your own instead of one of these.

SiFive's first FE-310 and FU-540 SoCs in 2016-17 are almost straight Rocket (and the improvements they made then have been fed back into the Open Source project). The Kendryte K210 (dual core 64 bit 400 MHz microcontroller from 2019) appears to be absolutely unmodified Rocket, with some extra stuff added around it. That chip has shipped in probably the tens of millions if not hundreds of millions.

Pulp Project cores have been used in ESA spacecraft.

Quote
and the open-source license attached to the one you pick must fit your business model.

Rocket is BSD license. Pulp cores are lightly modified (for hardware) Apache 2.0.

Quote
All this is very far from just picking an ARM core, paying a fee and pretty much calling it day, for the most part.

If only it was as simple as going on the ARM web site, picking an option, digitally signing a contract, and putting in your credit card number!

Reports from many people who have been there and done that is that negotiating the contract and fees for even the simplest ARM core is a 12 to 18 month process involving many expensive lawyers, before you can even start the technical work.

The biggest technical difference is that with the cheaper ARM licenses what you get for the core is a hard macro that is pre-laid out for a specific process node. You just connect your own circuitry to the input and output wires of the core. While you can't modify the core in any way, you also don't have to do the physical layout and verification of it.

More expensive ARM licenses, and probably all current RISC-V cores, are delivered to you as RTL (possibly obfuscated) and you the customer are responsible for physical layout.
 
The following users thanked this post: thm_w, MT

Offline reimius

  • Newbie
  • Posts: 8
  • Country: es
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #32 on: February 03, 2023, 07:56:20 am »
First my apologies in advance if I did not well enough research, but there is something that I am being missed I believe, let me share.

The Reference manual: CH32V003RM.PDF (http://www.wch-ic.com/downloads/CH32V003RM_PDF.html) says that at the very first paragraph the ISA implemented is RV32EC which stands for the 16-bit long instruction extension and the reduced register file from 32 to 16 registers.

What confuses me, is about the C extension, is just that, an extension to a base ISA like the I base, so to improve code density. But itself the extension is that, an extension it cannot even address all 16 registers for some of the instruction, only the higher 8 (of 16). The specification (The RISC-V Instruction Set Manual Volume I, 20191213) even says that the Standard C extension is mean to be on top of a base extension. Source: riscv-spec-20191213.pdf (https://github.com/riscv/riscv-isa-manual/releases/download/Ratified-IMAFDQC/riscv-spec-20191213.pdf)

So here is the question is, what is the actual base ISA for this chip? I guess is the RV32I, but I cannot find a reference to it. I believe this can be a point, for example, if you want to do a pin toggling :) to know which instructions are really available!
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #33 on: February 03, 2023, 09:39:24 am »
What confuses me, is about the C extension, is just that, an extension to a base ISA like the I base, so to improve code density. But itself the extension is that, an extension it cannot even address all 16 registers for some of the instruction, only the higher 8 (of 16).

Yes, specifically r8-r15, the same as when applied to RV32I or RV64I. They happen to be the hi 8 registers in RV32E, yes, but not in the others.

This is no different to ARM Thumb/Thumb2, in which it is the low 8 registers that can be used by all 2-byte instructions, with several of the high 8 registers performing implicit jobs (PC, LR, SP). In RISC-V it is similar, but it is the low registers with implicit uses: Zero, RA (LR), SP.

In Thumb the 2-byte instructions that can use all 16 registers are MV, ADD, CMP, BX, PUSH, POP.

In RV32I/RV32E, the 2-byte instructions that can use all 32 (or 16) registers (with some individual exceptions for combinations that don't make sense) are:  C.LI, C.LUI, C.ADDI, C.SLLI, C.MV, C.ADD, C.LWSP, C.SWSP.

Quote
So here is the question is, what is the actual base ISA for this chip? I guess is the RV32I.

No, the base ISA is RV32E.

RV32E is not an extension of RV32I, it is its own base ISA defined by "Copy RV32I, hard coding the MSB of all register fields to '0'. Instructions with a '1' in those positions are undefined reserved instructions."
 
The following users thanked this post: chickenHeadKnob, reimius

Offline EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 37730
  • Country: au
    • EEVblog
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #34 on: February 03, 2023, 12:31:00 pm »
FYI, WCH just contacted me and said they saw the video which has been very popular and have offered me parts. What should I get?  :-//
 

Offline reimius

  • Newbie
  • Posts: 8
  • Country: es
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #35 on: February 03, 2023, 01:56:22 pm »
So here is the question is, what is the actual base ISA for this chip? I guess is the RV32I.

No, the base ISA is RV32E.

RV32E is not an extension of RV32I, it is its own base ISA defined by "Copy RV32I, hard coding the MSB of all register fields to '0'. Instructions with a '1' in those positions are undefined reserved instructions."

There you go! My bad, I was thinking that E was an extension, definitely I read the riscv specs too fast, it  clearly states: "RV32E base integer instruction set" even the word Base is in the title of the chapter  |O

Thanks Bruce!
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 77
  • Country: es
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #36 on: February 04, 2023, 01:29:44 am »
FYI, WCH just contacted me and said they saw the video which has been very popular and have offered me parts. What should I get?  :-//

The CH582M is a very interesting IC. It is also RISC-V, around 1€/pc, , It has two USBs, one USB host, and Bluetooth frontend, along with the typical periferals of the CH32VXXX. Some cheap development boards (about 3-4€) are appearing for buying, also there is a port to Arduino currently being developed.

 
The following users thanked this post: EEVblog

Offline wdbarker3

  • Contributor
  • Posts: 15
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #37 on: February 13, 2023, 10:18:17 pm »
Dave, I know you were pleased to do the blinky. But . . .

My CH32V's arrived today, and before hookinhg up the IDE and the demo chip, I plugged it in. D1 blinked at 250ms on/250ms off. I'm sure glad you tried other durations in your test, but that first one didn't demonstrate much<g>!

Now, to re-remember Eclipse . . .
 

Offline 3roomlab

  • Frequent Contributor
  • **
  • Posts: 825
  • Country: 00
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #38 on: February 16, 2023, 12:24:57 pm »
I just want to share something I tried regarding translating chinese pdf into english

in the amphour #619, there is some mention about PUYA mcu.
https://www.lcsc.com/products/Microcontroller-Units-MCUs-MPUs-SOCs_11329.html?brand=11580

https://www.puyasemi.com/cpzx3/info_271_aid_247_kid_246.html
the spec pdf download is a whooping 149MB, and you get the entire product folder.

so to do the translating, I used libreoffice 6.4 + pagetranslate.oxt extension
The translator add-on requires access to internet to work
1 page needs about 10s to process (the internet meter runs about 400kbps for 10s)
I tried 4 pages for sample viewing, and below I attached 1 of them

the pdf conversion have some quirks and some misses, the text come across as boxes everywhere.
Manual stitching was not that bad, each page takes about 3-5minutes of fiddling around.
(and abt 1 hr of libreoffice setup if you are not on it)

so there is a good chance anybody can use this method to translate straight from their chinese pdf
I suppose a professional OCR is better, but I have not tried those.

1 of the quirks is that the stitched text will shoot beyond the right margin
in my lazy mode, I changed the page size to A3 landscape and simply ignore more manual fiddling with boxes, this saves time.
I hope this could be of some help  >:D
« Last Edit: February 16, 2023, 12:45:20 pm by 3roomlab »
 

Online thm_w

  • Super Contributor
  • ***
  • Posts: 6352
  • Country: ca
  • Non-expert
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #39 on: February 16, 2023, 10:17:19 pm »
I just want to share something I tried regarding translating chinese pdf into english

Did you try the google pdf translator?

edit: Interesting that every PDF link is just a RAR of the entire datasheet collection..
Profile -> Modify profile -> Look and Layout ->  Don't show users' signatures
 
The following users thanked this post: 3roomlab

Offline 3roomlab

  • Frequent Contributor
  • **
  • Posts: 825
  • Country: 00
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #40 on: February 17, 2023, 08:42:50 am »
I just want to share something I tried regarding translating chinese pdf into english

Did you try the google pdf translator?

edit: Interesting that every PDF link is just a RAR of the entire datasheet collection..

I was reading the pagetranslate.oxt extension web page and it says it uses google translate
and here I forgot all about source itself which is google document upload function *facepalm me!*
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #41 on: February 17, 2023, 10:24:16 pm »
FYI, WCH just contacted me and said they saw the video which has been very popular and have offered me parts. What should I get?  :-//

All of them? ;D
 

Offline BlakeSeven

  • Newbie
  • Posts: 5
  • Country: gb
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #42 on: February 24, 2023, 05:39:03 pm »
Try their little 8 pin CH32V003 J4M6?
 

Offline willmore

  • Newbie
  • Posts: 6
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #43 on: April 06, 2023, 09:08:11 pm »
I just got my parts in from Ali.  I got 50 J4M6 (because why not?), 50 F4P6, and the WCH-LinkE+F4P6 dev board (and 5 more chips).

I've got the dev environment (ch32v003fun) running and I've programmed the dev board with the blink and ws2812b examples and they work.  So, that was fun.  I haven't tried programming the 8 pin chips yet as I'd like to know more about how their I/O works.  There's a lot of I/O stuffed onto 6 pins.  In particulat, I want to know about the limitations WRT programming over SWIO (pin 8, PD1) which is shared with a lot of other functions.  I have no idea if you can use that pin as an I/O *and* for programming or how that works.

If you can't share that pin, then something as simple as the default blink code (which uses PD4--pin 8 of the J4M6) would effectively make the part OTP as it's not going to be SWIO anymore.  I'd like to get some clarification on that before I commit too much.

My intention is to design a dev board for the two variants I got, but I'll want to get a little more experience with them before I make boards.  I also want to find a cheap USB-C socket to use--I've used up all the micro-USB-B sockets I had and I'd like to move up to C.  Suggestions welcome.

I'm not new here, I had an account a long time ago and somehow it got lost, so I recreated it today.  Hello, all!
 

Offline rhodges

  • Frequent Contributor
  • **
  • Posts: 306
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #44 on: April 06, 2023, 09:25:03 pm »
I haven't tried programming the 8 pin chips yet as I'd like to know more about how their I/O works.  There's a lot of I/O stuffed onto 6 pins.  In particulat, I want to know about the limitations WRT programming over SWIO (pin 8, PD1) which is shared with a lot of other functions.  I have no idea if you can use that pin as an I/O *and* for programming or how that works.
Here is my story:
https://www.eevblog.com/forum/microcontrollers/ch32v003-j4-(sop8)-pins/msg4726238/#msg4726238
Quote
If you can't share that pin, then something as simple as the default blink code (which uses PD4--pin 8 of the J4M6) would effectively make the part OTP as it's not going to be SWIO anymore. 
Yes, indeed. A large timeout after reset and before configuring the pin might be okay for development.
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 
The following users thanked this post: willmore

Offline willmore

  • Newbie
  • Posts: 6
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #45 on: April 07, 2023, 05:53:15 pm »
Thank you, that's one of the sources of my concern.  I was searching for that thread and didn't find it.  Thank you for finding me. :)

Another one is a reference I found from one of the programming tools that the ch32v003 are unbrickable as long as you have acces to the NRST pin.  Then I looked at the J4M6 pinout and saw that it *didn't have* that signal.

I like your suggestion to have a large timeout before setting that pin to output.  I'll keep that in mind as I explore more about these chips.  There's a lot of info out there, but it's not well organized and that's being charatible.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #46 on: April 08, 2023, 01:04:24 am »
Thank you, that's one of the sources of my concern.  I was searching for that thread and didn't find it.  Thank you for finding me. :)

Another one is a reference I found from one of the programming tools that the ch32v003 are unbrickable as long as you have acces to the NRST pin.  Then I looked at the J4M6 pinout and saw that it *didn't have* that signal.

So do your development on a chip with 20 pins, e.g. the ones on the official dev board or for that matter the $1.50 "nano" board (below, mine came joined in snap-off sets of three)

 

Offline ballsystemlord

  • Regular Contributor
  • *
  • Posts: 123
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #47 on: April 17, 2023, 08:03:44 pm »
So, where are these RISC-V processors being sold for $0.10 each? I watched the whole video, looked at all linked content, searched on Aliexpress and ebay. I can't find them that cheap, even in 100pcs (bulk) quantity.
 

Online SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14447
  • Country: fr
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #48 on: April 17, 2023, 08:08:32 pm »
So, where are these RISC-V processors being sold for $0.10 each? I watched the whole video, looked at all linked content, searched on Aliexpress and ebay. I can't find them that cheap, even in 100pcs (bulk) quantity.

Are you saying that the title may have been a bit of a clickbait? ::)

Now, the CH32V003 is listed at $0.13 - $0.15 at LCSC per 500+ (even if it's not actually available there at the moment), so I have no doubt you can get it for $0.10 or less at large quantities... as long as you ca get ahold of them.
 

Offline DavidAlfa

  • Super Contributor
  • ***
  • Posts: 5896
  • Country: es
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #49 on: April 17, 2023, 08:31:25 pm »
Why so much hype about the CH when the Puya seems way better for the same price?
Hantek DSO2x1x            Drive        FAQ          DON'T BUY HANTEK! (Aka HALF-MADE)
Stm32 Soldering FW      Forum      Github      Donate
 

Offline ballsystemlord

  • Regular Contributor
  • *
  • Posts: 123
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #50 on: April 17, 2023, 08:46:31 pm »
Why so much hype about the CH when the Puya seems way better for the same price?
Part-number? Link?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11238
  • Country: us
    • Personal site
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #51 on: April 17, 2023, 08:59:59 pm »
Part-number? Link?
https://www.lcsc.com/products/Microcontroller-Units-MCUs-MPUs-SOCs_11329.html?keyword=Puya%20

They are 24 MHz Cortex-M0+ devices. The interest here is RISC-V. There are a lot of cheap ARM MCUs, but nobody here consumes enough of them for the price to matter that much.

From a practical point of view, if I had an actual project, currently I'd go with ARM, but it does not hurt to look at alternatives.
Alex
 

Offline ballsystemlord

  • Regular Contributor
  • *
  • Posts: 123
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #52 on: April 17, 2023, 09:20:02 pm »
<snip>
They are 24 MHz Cortex-M0+ devices. The interest here is RISC-V. There are a lot of cheap ARM MCUs, but nobody here consumes enough of them for the price to matter that much.

From a practical point of view, if I had an actual project, currently I'd go with ARM, but it does not hurt to look at alternatives.

Well, even the attiny 13 is ~$0.50 per piece when buying 10pcs (and more for 50pcs, surprisingly, from aliexpress). So, in looking for a lower cost part, a 10 cent one is very appealing. If I buy 10, I'm saving $4, and I'm getting more I/O (which tends to really drive up costs), and other resources for my efforts.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11238
  • Country: us
    • Personal site
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #53 on: April 17, 2023, 09:41:28 pm »
Sure, why not? It does not hurt to consider all the alternatives. They for sure replace attiny, those things are known to be way overpriced for capabilities.
Alex
 

Offline chickenHeadKnob

  • Super Contributor
  • ***
  • Posts: 1055
  • Country: ca
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #54 on: April 18, 2023, 02:44:19 pm »
At the fifty cent level (quantity 10) you have CH32V203C - 48 pin QFP on LCSC.com:
https://www.lcsc.com/search?q=ch32v203

This has great features for the money, 64K flash 20K RAM 2 USB(s)! and CAN. I think this might be the best value for money in the whole WCH portfolio. I don't understand why this part is priced cheaper than some of the other parts like CH32F103 or CH32V103.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #55 on: April 18, 2023, 03:04:18 pm »
So, where are these RISC-V processors being sold for $0.10 each? I watched the whole video, looked at all linked content, searched on Aliexpress and ebay. I can't find them that cheap, even in 100pcs (bulk) quantity.

10c each, right here, if you've got US$5 to spend.

https://www.aliexpress.us/item/1005005036714708.html
 
The following users thanked this post: edavid, ballsystemlord

Offline willmore

  • Newbie
  • Posts: 6
  • Country: us
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #56 on: May 03, 2023, 02:18:08 pm »
For those worried about bricking the 8 pin chip by reusing NRST and the SWIO pins/functions, worry not.  There's an un-bricker function in the minichlink progam from ch32v003fun.  If you give it the '-u' option and let the LinkE device control the power for the chip, it can catch it at the right time after powerup to reprogram it.  I've used it a number of times and it's very helpful.  It's almost part of my standard reprogramming routine now that I know I can use those pins safely for other tasks.

This function also is helpful for first time programming on other chips as there have been a few people complaining that the normal programming process doesn't work for them on new chips.  Which is a bit strange, but at least there's an easy solution.
 
The following users thanked this post: edavid, brucehoult, rhodges

Offline OZ1LQB

  • Regular Contributor
  • *
  • Posts: 51
  • Country: dk
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #57 on: May 14, 2023, 01:46:47 pm »
Hi
does anyone here use them anymore or were they just interesting because they were new and very very cheap that they were interesting
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11238
  • Country: us
    • Personal site
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #58 on: May 14, 2023, 03:01:22 pm »
Define "use". There are lots of hobby projects being published using those devices.

If you mean used in real products, then I doubt it. For people here price difference would not make a lot of difference to justify the change at least initially. But the way you justify the change is by doing test hobby projects.

This is the same way ESP2866 gained adoption. It started with hobby and all the "professional" companies laughed at them, and a couple years later the same companies were writing "fighting guides" for their sales teams.
Alex
 

Offline OZ1LQB

  • Regular Contributor
  • *
  • Posts: 51
  • Country: dk
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #59 on: May 14, 2023, 03:50:04 pm »
yes, I mean both as a hobby but also professionally.
I couldn't resist the temptation and bought a huge pile.
it's just a hobby for me, hence my question
Claus in Denmark
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11238
  • Country: us
    • Personal site
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #60 on: May 14, 2023, 04:00:39 pm »
It would take 2-3 years for professional adoption. This is sufficient time to understand and figure out all the issues of the device and if there is a consistent supply. A lot of those cheap ICs appear and disappear on LCSC and it is very hard to judge if this is something you would be able to get reliably.

WCH is not a complete no-name brand, but they are known to discontinue devices. And when they do it, they basically disappear from retail. I assume big customers can still get them, but it does not help the rest of us.
Alex
 

Offline OZ1LQB

  • Regular Contributor
  • *
  • Posts: 51
  • Country: dk
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #61 on: May 14, 2023, 04:17:38 pm »
Hi again.
yes, I'm aware of that. that's why I bought a supply that can last the rest of my life, this applies to both chips and programmer
 

Offline robby.roboter@gmail.com

  • Newbie
  • Posts: 1
  • Country: ee
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4028
  • Country: nz
Re: EEVblog 1524 - The 10 CENT RISC V Processor CH32V003
« Reply #63 on: July 11, 2023, 10:19:45 am »
WCH is not a complete no-name brand, but they are known to discontinue devices. And when they do it, they basically disappear from retail. I assume big customers can still get them, but it does not help the rest of us.

From talking to their Technical Director Patrick (by voice) a few months ago, I believe they'd always be happy to tell the fab to drag out the masks and run even a single 3000 die wafer.

They also do customised chips in 3000 unit minimum, though in that case of course there would be additional NRE cost.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf