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

0 Members and 1 Guest are viewing this topic.

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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: 7083
  • 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: 4455
  • 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.
-------------------------
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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: 4455
  • 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: 7083
  • 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
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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.
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14731
  • 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.
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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: 5129
  • Country: bt
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?
Readers discretion is advised..
 

Online thm_w

  • Super Contributor
  • ***
  • Posts: 7083
  • 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
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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: 4455
  • 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: 5129
  • Country: bt
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..
Readers discretion is advised..
 

Online EEVblogTopic starter

  • Administrator
  • *****
  • Posts: 38556
  • 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf