Author Topic: WCH $0.10 USD RISC-V MCU  (Read 50841 times)

0 Members and 1 Guest are viewing this topic.

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #50 on: November 08, 2022, 09:13:44 am »
I asked for 1K unit of CH32V003F4P6, and they told me it's 0.127$,I was expecting a better price tough ^-^
So I asked them when I should expect under 0.1$, waiting for their answer.

That seems pretty good for a 20 pin package.  Maybe the 8 pin is cheaper.
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1930
  • Country: ca
Re: WCH $0.10 USD RISC-V MCU
« Reply #51 on: November 08, 2022, 11:51:00 am »
I want to order 1K units, they told me the 0.1$ price is for the 8 pin package.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline tim_

  • Regular Contributor
  • *
  • Posts: 241
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #52 on: November 09, 2022, 09:06:22 pm »
I received my kit today. Made a good impression. The software can be downloaded from here:

https://www.wch.cn/products/WCH-Link.html

They left open how to connect the programmer to the MCU board. Will look into this tomorrow.

I decapsulated one device (True to the spirit of eevblog, i guess) and found that the IC is approximately 2 mm² in size. I assume that it is based on a dual voltage (1.5V/5V) CMOS process, most likely 130nm or 150nm, plus MTP memory. Considering die price, packaging and test cost, I don't think that this is a high margin product at $0.10, not even in china.

For comparison: The famous $0.03 MCU has a die size of 0.25mm², eight times smaller, and a single voltage process with lower mask count.

Nevertheless, I am very intrigued and am looking forward to some RV32EC hacking...

edit: Corrected scaling of images


« Last Edit: November 09, 2022, 09:17:27 pm by tim_ »
 
The following users thanked this post: thm_w, Muxr, I wanted a rude username

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #53 on: November 09, 2022, 09:15:27 pm »
This is a rather violent decapsulation. Are there pads in the middle of the die?

I've ordered the AliExpress one, so it will take a while to arrive here.
Alex
 

Offline tim_

  • Regular Contributor
  • *
  • Posts: 241
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #54 on: November 09, 2022, 09:20:31 pm »
This is a rather violent decapsulation. Are there pads in the middle of the die?

I've ordered the AliExpress one, so it will take a while to arrive here.

I just burned off the Epoxy binder, that's much faster than other methods. Some residue is left, I may have to try another iteration. But since I don't have a good microscope, I'll wait for other people to do better images :)

Yes, looks like there are test pads in the inner area of the die.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #55 on: November 10, 2022, 12:45:18 am »
Cool! So did you get your 1000 chips? Or you sacrificed a dev board?

Have you got a blinky running? What's the flashing process?
 

Offline tim_

  • Regular Contributor
  • *
  • Posts: 241
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #56 on: November 10, 2022, 06:52:52 am »
Cool! So did you get your 1000 chips? Or you sacrificed a dev board?

Have you got a blinky running? What's the flashing process?

The kit from Aliexpress actually comes with 5 MCUs as sample.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #57 on: November 10, 2022, 07:07:24 am »
I've ordered the extended version of the kit with CH32V203 as well. I want to play with SWD interface on non-ARM devices. I wonder if this is just the name they use, or it is an actual SWD interfaace.

The 003 uses a single wire programming interface that does not appear to be documented anywhere, so there is some fun to be had in reverse-engineering that.

Shipping does not look too fast, but it is fine, I'll probably manage get to that on NY break anyway.
Alex
 

Offline tim_

  • Regular Contributor
  • *
  • Posts: 241
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #58 on: November 10, 2022, 01:04:50 pm »
Have you got a blinky running? What's the flashing process?

The device can be programmed and debugged based on a single line protocol. You have to connect PD1 with SWDIO on the WCH-LinkE (for some reason only mentioned on the Aliexpress website).

It's possible to use the mounriver IDE for debugging (with OpenOCD) or the WCH-Linkutility for programming.

The default code contained some example code that created a serial debug console via the serial interface one WCH-LinkE.

So far this looks like a capable development environment.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #59 on: November 11, 2022, 12:18:25 am »
Shipping does not look too fast, but it is fine, I'll probably manage get to that on NY break anyway.

OK I ordered one too. And a Pinecil. Est arrival in NZ Dec 30. Possibly away from home Dec 23 to Jan 9 anyway .. yet to be decided.
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1930
  • Country: ca
Re: WCH $0.10 USD RISC-V MCU
« Reply #60 on: November 11, 2022, 09:42:11 am »
I got volume pricing for the QFN part too

CH32V003F4U6 is 0.123$ so I have ordered around 500 unit for each of these models CH32V003F4U6 and CH32V003F4P6 .

I hope I did not do something stupid :'( >:D
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #61 on: November 11, 2022, 11:20:58 am »
I got volume pricing for the QFN part too

CH32V003F4U6 is 0.123$ so I have ordered around 500 unit for each of these models CH32V003F4U6 and CH32V003F4P6 .

I hope I did not do something stupid :'( >:D

Depends on how important $125 is to you and how much pleasure you get from it. It's definitely in "I'd just blow it on a dinner date anyway" range for me.
 

Offline ali_asadzadeh

  • Super Contributor
  • ***
  • Posts: 1930
  • Country: ca
Re: WCH $0.10 USD RISC-V MCU
« Reply #62 on: November 11, 2022, 02:13:32 pm »
Quote
Depends on how important $125 is to you and how much pleasure you get from it. It's definitely in "I'd just blow it on a dinner date anyway" range for me.
I have 1K units of snacks, I would be fat soon enough ;D

what's your use case for them?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #63 on: November 14, 2022, 10:10:56 pm »
They left open how to connect the programmer to the MCU board. Will look into this tomorrow.

This is different devices, but maybe offers some clues?

https://www.cnblogs.com/iot-fan/p/13498088.html

Edit:

An apparently working procedure, specifically for the CH32V103 kit ...

https://www.reddit.com/r/RISCV/comments/yu7xda/comment/iwcr95t/
« Last Edit: November 14, 2022, 11:11:24 pm by brucehoult »
 

Offline tim_

  • Regular Contributor
  • *
  • Posts: 241
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #64 on: November 15, 2022, 09:13:42 pm »
They left open how to connect the programmer to the MCU board. Will look into this tomorrow.

This is different devices, but maybe offers some clues?


It was actually explained on the Aliexpress website. SWDIO from the programmer needs to be connected to PD1 of the device + power supply. That's it.

MounRiver Studio worked out-of-the-box for programming and debugging (using OpenOCD). The programmer also supports a UART that allows printf-style debugging.

All-in-all I'd say there is less friction than with the STM toolchain. My main grievance would be that Mounriver is Eclipse based....

I did not try working with any of the peripherals, though. So maybe there are still some bugs.

There is no multiplier in the device and multiplication are emulated by a software call.

Code: [Select]
000000b4 <__mulsi3>:
  b4: 862a                mv a2,a0
  b6: 4501                li a0,0
  b8: 0015f693          andi a3,a1,1
  bc: c291                beqz a3,c0 <__mulsi3+0xc>
  be: 9532                add a0,a0,a2
  c0: 8185                srli a1,a1,0x1
  c2: 0606                slli a2,a2,0x1
  c4: f9f5                bnez a1,b8 <__mulsi3+0x4>
  c6: 8082                ret

« Last Edit: November 15, 2022, 09:49:11 pm by tim_ »
 
The following users thanked this post: BlakeSeven

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #65 on: November 16, 2022, 12:24:36 am »
All-in-all I'd say there is less friction than with the STM toolchain. My main grievance would be that Mounriver is Eclipse based....

Good to know.

Quote
There is no multiplier in the device and multiplication are emulated by a software call.

That's expected as the ISA is RV32EC. No "M".

This affects Coremark (with all its matrix multiplies) much more than it affects most actual applications.

Cortex-M0+ always has a multiply instruction present, but depending on which option the vendor paid for it may take 32 clock cycles.

Competition such as 6502, 6800 derivatives (except 6809, which is not binary compatible), z80, msp430, low end PIC don't have multiply.

8051 does (4 cycles).

That multiply routine takes about 6 cycles per significant bit in the 2nd operand, so if you're multiplying by something smallish (and positive) then definitely put that 2nd if you can.
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #66 on: November 16, 2022, 12:35:10 am »
Cortex-M0+ always has a multiply instruction present, but depending on which option the vendor paid for it may take 32 clock cycles.
I can't imagine that price bump being too high, since I've yet to find an MCU that does not have one cycle multiplier. Slower one may have smaller die area, which may be a bigger concern. But again, it would be interesting to see what kind of device goes with a slower one.

My kits should arrive tomorrow, so I guess at least part of the fun would be moved to the Thanksgiving break.
Alex
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #67 on: November 16, 2022, 12:41:13 am »
Cortex-M0+ always has a multiply instruction present, but depending on which option the vendor paid for it may take 32 clock cycles.
I can't imagine that price bump being too high, since I've yet to find an MCU that does not have one cycle multiplier. Slower one may have smaller die area, which may be a bigger concern. But again, it would be interesting to see what kind of device goes with a slower one.

Single-cycle multiplier is likely to be the critical path for CPU MHz. Maybe not a problem on M0+ which seem to traditionally top out at 48 MHz -- except RP2040. Others?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #68 on: November 16, 2022, 01:20:18 am »
Single-cycle multiplier is likely to be the critical path for CPU MHz.
Yeah, that's a thing too.

Maybe not a problem on M0+ which seem to traditionally top out at 48 MHz -- except RP2040. Others?
STM32G0 are 64 MHz and use a single-cycle multiplier.
Alex
 

Offline josuah

  • Regular Contributor
  • *
  • Posts: 119
  • Country: fr
    • josuah.net
Re: WCH $0.10 USD RISC-V MCU
« Reply #69 on: November 16, 2022, 01:25:11 am »
Reference Manual published 48h ago: http://www.wch-ic.com/downloads/CH32V003RM_PDF.html
 
The following users thanked this post: paf

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #70 on: November 16, 2022, 01:30:51 am »
The change compared to v1.2  is in ADC section and a new 1 page Chapter 18 "Debug Support (DBG)".

The old one stated "up to 4MHz or 6MHz input clock" the new one is "up to 24MHz input clock".
Alex
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #71 on: November 17, 2022, 02:52:00 am »
I've got the boards. I decided to start with CH32V203, since it might have a standard SWD interface. And so far I'm not making a lot of progress.

It does appear to be similar to SWD, since after the link reset sequence, reading IDCODE register ends with a status 0 (invalid), and any followup transfers end with device not driving the bus at all. And if the first read is not IDCODE, then it also ignores them. Ignoring is normal, SWD protocol requires IDCODE read to finish interface initialization. But the invalid response is not normal.

And repeated link reset actually resets it back to returning the invalid status, so it recognizes that sequence in some way as well.
Alex
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4488
  • Country: nz
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 97
  • Country: es
Re: WCH $0.10 USD RISC-V MCU
« Reply #73 on: November 17, 2022, 12:49:20 pm »
I've got the boards. I decided to start with CH32V203, since it might have a standard SWD interface. And so far I'm not making a lot of progress.

It does appear to be similar to SWD, since after the link reset sequence, reading IDCODE register ends with a status 0 (invalid), and any followup transfers end with device not driving the bus at all. And if the first read is not IDCODE, then it also ignores them. Ignoring is normal, SWD protocol requires IDCODE read to finish interface initialization. But the invalid response is not normal.

And repeated link reset actually resets it back to returning the invalid status, so it recognizes that sequence in some way as well.

I purchased 10 pcs CH32V203C8T6, and since they have the same pinout than the STM32F103C8T6, i swapped one into a bluepill. I flashes the USB example fimwares downloaded from the WCH page, and all worked fine. However there is no code for implementing a CDC device using this part, and my atempts of porting several C source codes from the STM32F103, have failed (when i eventually make them to compile, they do nothing at run time).

The WCH forums aren't of any help. The staff there keep saying from time to time that they are still working on it...
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11729
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #74 on: November 18, 2022, 03:55:44 am »
I've got to experiment with the boards today. The protocol is most definitely not a standard ARM DAP even on parts with two line interface, they just picked the signal names to match ARM counterparts.

At this time, I'm not all that interested to reverse engineering this. And from my point of view this is going to slow down the adoption of RISC-V MCUs. If every vendor comes up with their own debugging and programming interfaces, it would be a huge nightmare. Especially if those vendors don't bother documenting the protocol and their tools suck so much.

Also, their software definitely tries to phone home. I ran it in an isolated VM not connected to the internet and some operations take suspiciously long time. It can be checking for updates and stuff, but still, be careful.
Alex
 
The following users thanked this post: I wanted a rude username


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf