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

0 Members and 2 Guests are viewing this topic.

Offline martinribelotta

  • Regular Contributor
  • *
  • Posts: 65
  • Country: ar
  • A camel is a horse designed by a committee
    • Martin Ribelotta design services
Re: WCH $0.10 USD RISC-V MCU
« Reply #200 on: February 21, 2023, 03:52:13 pm »
Now, Patrick just posted the 1-wire protocol of debug:
https://github.com/openwch/ch32v003/blob/main/RISC-V%20QingKeV2%20Microprocessor%20Debug%20Manual.pdf

I hope that this protocol be the same for ch32v307 and familly but addapting the transport to 2-wire interface (Man I need a weekend free to put a logic analyzer over CK and DIO lines on my ch32v307 board)
 

Offline gmb42

  • Frequent Contributor
  • **
  • Posts: 294
  • Country: gb
Re: WCH $0.10 USD RISC-V MCU
« Reply #201 on: February 22, 2023, 11:01:16 am »
A tiny $1.50 WCH dev board from Muse labs, the nanoCH32V003. See https://linuxgizmos.com/the-nanoch32v003-is-a-risc-v-dev-board-available-for-1-50/
 

Offline elecdonia

  • Frequent Contributor
  • **
  • Posts: 399
  • Country: us
Re: WCH $0.10 USD RISC-V MCU
« Reply #202 on: February 22, 2023, 08:03:37 pm »
I think it's fascinating that Chinese vendors seem to have started targeting American "hobbyists" - cheap development boards, free development environments, documentation in English (even if it's not very good documentation), chips for sale in retail quantities, etc...   I'm guessing it's due to the success of Espressif.  But it's certainly fun times!
I think of myself as more of a “frugal independent developer” than “hobbyist.”

I retired after a 20+ year full-time hardware/software design engineer position (at one company!). These days I still have plenty of projects but a much more limited budget compared to when my employer was willing to purchase (most) of the development supplies I requested.

I continue to support Arduino.cc, Raspberry Pi, adafruit, Sparkfun, and Teensy by frequently purchasing items directly from them. Without them we wouldn’t have either the hardware or the tools to make cost-effective embedded systems.

But I also find it irresistible to sample the enormous smorgasboard of Chinese clones, modules, boards, and tools. It costs almost nothing to try them out. Some items are junk. Others are quite well made and stable over time.
I’m learning to be a leading-edge designer of trailing-edge technology.
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1538
  • Country: gb
Re: WCH $0.10 USD RISC-V MCU
« Reply #203 on: February 22, 2023, 08:58:44 pm »
Don't you just love it when there are inconsistencies between what a manufacturer's documentation says and what code in their HAL/SPL/etc actually does? ;D

There are a couple of such inconsistencies I've noticed in the CH32V003 Reference Manual (as of latest available, v1.3).

First is to do with the RCC clock configuration register CFGR0. According to the Reference Manual, bits 10:8 are "reserved" and bits 15:11 are for ADCPRE (ADC clock source divider). But wait! The library headers give bits 10:8 as for PPRE1 (APB1 clock source divider), bits 13:11 as PPRE2 (APB2 clock source divider), and only bits 15:14 for ADCPRE.

Did they decide to throw out the ability to run APB1 and APB2 at speeds different than the main AHB clock in order to have a greater range of dividers for the ADC? It may be that the docs are correct, because the separate header file for the RCC peripheral defines its own set of values for the ADC prescaler field that match the docs, and they forgot to update the main header file (it seems to be a pattern that peripheral-specific header files define their own register constants, in duplication of the main header). Who to believe?

The second instance is with the I2C peripheral. The manual documents that bits 14:10 of the OAR1 register are "reserved", but yet the I2C_AcknowledgedAddress_7bit constant in the I2C header file has the value 0x4000, which has bit 14 set, and this constant is always written to the register by the I2C_Init function.

So what is this bit? It rang a bell in my memory, that I had seen something like this before. Lo and behold, the I2C peripheral of the STM8 has in its OARH register an ADDCONF bit 14 which is documented as "This bit must set by software (must always be written as '1')". Hmmmmm... Are WCH using the exact same I2C peripheral? Everything else seems to also be highly similar to that of the ST chip. Did they buy the same third-party implementation? Or did they clone it so well, they included the flaws too? :-DD
« Last Edit: February 23, 2023, 02:02:54 pm by HwAoRrDk »
 
The following users thanked this post: karpouzi9

Offline josuah

  • Regular Contributor
  • *
  • Posts: 119
  • Country: fr
    • josuah.net
Re: WCH $0.10 USD RISC-V MCU
« Reply #204 on: February 26, 2023, 09:32:08 am »
so, the ATTiny8 is done for, right? end of an era  :-\

It will be when the power consumption will also match:

In standby, 25°, with the low speed oscillator running (for waking-up periodically and trigger an ADC readout for instance):

Not everything has lower than 1 uA battery consumption as requirement though.
 
The following users thanked this post: karpouzi9

Offline tim_

  • Regular Contributor
  • *
  • Posts: 240
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #205 on: February 26, 2023, 05:45:07 pm »
VDDmin is also much lower for the ATtinies.
 
The following users thanked this post: karpouzi9

Offline MT

  • Super Contributor
  • ***
  • Posts: 1652
  • Country: aq
Re: WCH $0.10 USD RISC-V MCU
« Reply #206 on: March 10, 2023, 12:05:48 am »
CH32V203 manual.

In the Standby mode, the contents of 32KB of SRAM can be kept (depending on the planning and configuration before going to bed), and the contents of the backup registers are kept. :)
 

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14892
  • Country: fr
Re: WCH $0.10 USD RISC-V MCU
« Reply #207 on: March 10, 2023, 12:12:02 am »
CH32V203 manual.

In the Standby mode, the contents of 32KB of SRAM can be kept (depending on the planning and configuration before going to bed),

Good night! ;D
 

Offline Sacodepatatas

  • Regular Contributor
  • *
  • Posts: 90
  • Country: es
Re: WCH $0.10 USD RISC-V MCU
« Reply #208 on: March 10, 2023, 01:29:40 am »
Also CH32V203 Datasheet...
 

Offline 1276-2449-1-ND

  • Regular Contributor
  • *
  • Posts: 63
  • Country: ca
Re: WCH $0.10 USD RISC-V MCU
« Reply #209 on: April 18, 2023, 09:44:58 pm »

... and configuration before going to bed), and the contents of ... :)


If you put your ear to it when shutting down you can hear it beep and buzz a little lullaby.  :-DD
 

Offline jnk0le

  • Regular Contributor
  • *
  • Posts: 68
  • Country: pl
Re: WCH $0.10 USD RISC-V MCU
« Reply #210 on: May 06, 2023, 01:24:10 pm »
FYI

With a bit cursed github workflow, I've got someones GPL-lettered openocd fork to build windows binaries.

https://github.com/jnk0le/openocd-wch/releases/tag/29042023

v003 confirmed to work and open eclipse debug session.
No idea about the rest as I don't own those and cfg scripting is cursed similarly to code quality (even compared to extracts from MRS).

EDIT: it turns out that it requires proprietary drivers to work (enumerate as WCH-LinkRV instead of WCH-Link). Zadig WinUSB doesn't work.
« Last Edit: May 13, 2023, 01:37:48 pm by jnk0le »
 

Offline jnk0le

  • Regular Contributor
  • *
  • Posts: 68
  • Country: pl
Re: WCH $0.10 USD RISC-V MCU
« Reply #211 on: May 06, 2023, 06:19:49 pm »
some notes after briefly debugging this thing:

- debugger cannot step over `ebreak` instructions (single step as well as "continue" option). However eclipse breakpoints do work. Probably something with openocd code.

- MIE csr register is non functional

- `mie` bit can be written (high) by csr instructions only when it's written together with `mpie` (must write 0x88 instead of 0x08).
Debugger can however write `mie` bit without touching `mpie`

- after a hard reset (remove power, short vcc to gnd), sometimes the `mpop` and `mppop` are set in `mstatus` register

- 0x744 in `ra` after hard reset (anyone else?)
« Last Edit: May 06, 2023, 07:49:33 pm by jnk0le »
 

Offline jnk0le

  • Regular Contributor
  • *
  • Posts: 68
  • Country: pl
Re: WCH $0.10 USD RISC-V MCU
« Reply #212 on: May 07, 2023, 01:41:35 pm »
Finally got the startup code a bit more optimized than the vendor one.
https://github.com/jnk0le/simple-crt/tree/master/ch32v003

while(1) is 208 bytes with static initializers (194 without), and blinky (volatile delay)  is 286 bytes.

ED: now it's 202, 188, and 280 bytes
« Last Edit: May 12, 2023, 11:27:13 pm by jnk0le »
 

Offline HwAoRrDk

  • Super Contributor
  • ***
  • Posts: 1538
  • Country: gb
Re: WCH $0.10 USD RISC-V MCU
« Reply #213 on: May 07, 2023, 07:18:56 pm »
- MIE csr register is non functional

That's because it doesn't have an MIE register (nor MIP). The list of supported CSR registers can be found in the WCH QingKeV2 CPU manual.

Interrupt enable/disable/status are controlled by the proprietary PFIC peripheral using the PFIC_* registers (I say 'proprietary', but it's basically a clone of the STM32F103's NVIC).
 
The following users thanked this post: SiliconWizard

Offline jnk0le

  • Regular Contributor
  • *
  • Posts: 68
  • Country: pl
Re: WCH $0.10 USD RISC-V MCU
« Reply #214 on: May 07, 2023, 08:36:09 pm »

Interrupt enable/disable/status are controlled by the proprietary PFIC peripheral using the PFIC_* registers (I say 'proprietary', but it's basically a clone of the STM32F103's NVIC).

Those are per interrupt ones somewhat redundant to the core `mie` in `mstatus`, and the ones inside peripherals.
« Last Edit: May 07, 2023, 08:38:25 pm by jnk0le »
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4238
  • Country: us
Re: WCH $0.10 USD RISC-V MCU
« Reply #215 on: May 08, 2023, 12:21:00 am »
Quote
a clone of the STM32F103's NVIC
Is the STM's NVIC anything different that the ARM Cortex-M3 NVIC?

 

Offline GromBeestje

  • Frequent Contributor
  • **
  • Posts: 282
  • Country: nl
Re: WCH $0.10 USD RISC-V MCU
« Reply #216 on: May 08, 2023, 05:35:59 am »
It is standard Cortex M
 

Offline quince

  • Contributor
  • Posts: 35
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #217 on: July 14, 2024, 05:02:40 am »
So, these are discontinued, right?

https://www.lcsc.com/search?q=ch32v

Hardly any are available in >1000 quantity and they're barely competitive on price against the RP2040 or any ESP32.

Did all demand dry up?
 

Online ataradov

  • Super Contributor
  • ***
  • Posts: 11474
  • Country: us
    • Personal site
Re: WCH $0.10 USD RISC-V MCU
« Reply #218 on: July 14, 2024, 05:11:59 am »
LCSC never has consistent stock of any MCUs/FPGAs. They only reliably carry passives and connectors from time to time.

And also, lack of devices at a distributor is more of an indicator that there is demand elsewhere. They are not discontinued and there are new devices added to the series constantly. It is just really hard to get them.
Alex
 
The following users thanked this post: quince

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14892
  • Country: fr
Re: WCH $0.10 USD RISC-V MCU
« Reply #219 on: July 14, 2024, 05:23:26 am »
Yep, but even so, LCSC has never had much CH32V003 that I remember of. They've consistently had CH32V307, and a few others. Don't look at stock quantities. Stock never really exceeds a few hundreds, but for more you'll have to ask for a quote.

The CH32V003 is available in relatively large quantities from many shops on Aliexpress. Whether you consider that an option or not is your call, not that we have much choice.
 
The following users thanked this post: quince

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4218
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #220 on: July 14, 2024, 05:41:35 am »
Discontinued? Why on Earth?

The mask sets will be on file, ready to use at any time, for as long as the production line for that node exists. WCH can run a wafer, or 100 wafers, any time a big order comes in, subject to capacity of course.

CTO Patrick Yang is easy to reach by email or even on Twitter. I would think anyone wanting non-hobby quantities, especially on a regular basis, would work directly with WCH for -- you know -- better prices and to allow them to schedule their production runs. They're a small agile company, not an Intel.
 
The following users thanked this post: quince

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 4218
  • Country: nz
Re: WCH $0.10 USD RISC-V MCU
« Reply #221 on: July 14, 2024, 05:49:11 am »
The CH32V003 is available in relatively large quantities from many shops on Aliexpress. Whether you consider that an option or not is your call, not that we have much choice.

I can't see any downside to using wchofficialstore.aliexpress.com if you just want 50 chips (or smallish multiples of that).

Sure, other Ali stores might offer some lower prices sometimes, and might or might not be dodgy, but the above is actual WCH using Aliexpress for order-taking and maybe fulfilment, the same way as thousands of companies use Amazon in the west.

It's no less safe than LCSC or TME or Digikey or Mouser.
 
The following users thanked this post: SiliconWizard

Offline quince

  • Contributor
  • Posts: 35
  • Country: de
Re: WCH $0.10 USD RISC-V MCU
« Reply #222 on: July 14, 2024, 08:14:39 am »
CTO Patrick Yang is easy to reach by email or even on Twitter. I would think anyone wanting non-hobby quantities, especially on a regular basis, would work directly with WCH for -- you know -- better prices and to allow them to schedule their production runs. They're a small agile company, not an Intel.

TY!
 

Offline tszaboo

  • Super Contributor
  • ***
  • Posts: 7576
  • Country: nl
  • Current job: ATEX product design
Re: WCH $0.10 USD RISC-V MCU
« Reply #223 on: July 14, 2024, 01:59:50 pm »
Yep, but even so, LCSC has never had much CH32V003 that I remember of. They've consistently had CH32V307, and a few others. Don't look at stock quantities. Stock never really exceeds a few hundreds, but for more you'll have to ask for a quote.

The CH32V003 is available in relatively large quantities from many shops on Aliexpress. Whether you consider that an option or not is your call, not that we have much choice.
WCH really has to work on their distribution channels. I never seen any linecard in Europe, and nothing is listed on their website.
For sure, you don't want to beg the manufacturer for a quote, lead time and shipping for a reel of ~300 EUR.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf