Author Topic: New low-end CH32V microcontrollers from WCH  (Read 1268 times)

0 Members and 1 Guest are viewing this topic.

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: gb
New low-end CH32V microcontrollers from WCH
« on: May 23, 2024, 05:01:56 pm »
Seems there are new CH32V microcontroller models from WCH. English datasheets for them have recently been published. No English reference manuals yet, though. Although I hear they are producing a single combined reference manual for all CH32V00x MCUs.

CH32V002
CH32V004
CH32V006

No idea about availability. I looked at WCH's official AliExpress store, but something must be wrong or being changed, as at time of writing there are no MCU products listed there at all. ???

The '002 and '004 are pin-compatible with the existing '003, but differ in the following ways:

CH32V003CH32V002CH32V004
CPU core:QingKe V2AQingKe V2CQingKe V2C
Instruction set:RV32ECRV32EmCRV32EmC
SRAM:2 kB4 kB6 kB
Flash:16 kB16 kB32 kB
Bootloader:1920 B3328 B3328 B
User NV storage:64 B256 B256 B
VDD range:3.3-5V2-5V2-5V
ADC:10-bit12-bit12-bit
Other peripherals:Op-amp & comparator8-ch touch controller-

From what I understand, the 'm' in the V2C CPU core's oddly-named "RV32EmC" instruction set stands for 'multiplication', but is not full 'M' extension support. That is, it is supposedly Zmmul - multiplication without division support. I am wondering what compiler support is currently like for that - hopefully it is just a case of passing -march=rv32ec_zicsr_zmmul to GCC. I'm assuming, otherwise, existing code for '003 will just run as-is without re-compilation (presuming it's not trying to use missing or changed peripherals, that is).

The increased power supply voltage range is handy, as it'll be possible to run the new chips straight from a lithium-ion battery.

The '004 seems to essentially be a '003 but with more RAM and flash.

For the new ADC, it also says that it now has 3 internal channels versus the previous two (Vref and Vcal). I am intrigued about what the extra third channel is - perhaps Vdd, or maybe even a temperature sensor? The latter would be very useful. I could probably try and find out from the Chinese language reference manual (which I believe is currently available), but I can't be bothered to go to that effort right now. :P Edit: It says right in the datasheet: "the OPA internal output channel is connected to the IN9 input channel". Vref is IN8 and Vcal IN10. Yeah, very useful for a chip without op-amp... ::)

Haven't investigated the '006 in any detail yet; it has 62 kB flash and 8 kB RAM, same 12-bit ADC, no touch controller, but retains the op-amp/comparator of the '003.
« Last Edit: May 23, 2024, 05:11:45 pm by HwAoRrDk »
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: au
Re: New low-end CH32V microcontrollers from WCH
« Reply #1 on: May 23, 2024, 09:00:27 pm »
Interesting family.
The 006 includes a 005 32k/6k variant, that comes down to QFN12 (2x2p0.4mm)
The 006 shows QFN32 but no TQFP32 ?

The 004 comes in only TSSOP20/QFN20 so is upgrade to 003.
The 002 (16k/4k) also comes in QFN12 and SO16N and SO8

Often dropped in the low end parts is a crystal oscillator, but I see these all have Xtal support, and even the QFN12 and SO8 pin out the crystal.
That opens up many logic replacement simple timing chain uses.

They appear to not have any 32.768kHz crystal support  ? 
Maybe they decide it is not a super low power usage part ?

 
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4107
  • Country: nz
Re: New low-end CH32V microcontrollers from WCH
« Reply #2 on: May 23, 2024, 09:41:03 pm »
RISC-V GCC has supported -march=rv32im -mno-div since at least 2018. But, yes, now there's an official extension for it.

It has always been legal to claim to support the M extension by, say, implementing mul in hardware but trap end emulate div/rem, but of course performance is better if the compiler calls the software div/rem routine explicitly.
 
The following users thanked this post: HwAoRrDk, SiliconWizard

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14682
  • Country: fr
Re: New low-end CH32V microcontrollers from WCH
« Reply #3 on: May 23, 2024, 09:46:19 pm »
As far as very cheap MCUs for small tasks, these are interesting. The new parts of the series have a bit more RAM and, most of all, an extended voltage range. I don't know if they have lower power consumption too.

As to hardware division, frankly for such small MCUs, that's rarely something that will be missing.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4107
  • Country: nz
Re: New low-end CH32V microcontrollers from WCH
« Reply #4 on: May 23, 2024, 10:03:16 pm »
Arm C-M0+ also has multiply but not divide -- though Arm gives chipmakers an option of a 1-cycle (limiting clock speed) or 32-cycle (only 2x faster than an A32[1] software routine) multiplier.

[1] yes I'm aware Cortex-M doesn't implement A32
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7492
  • Country: nl
  • Current job: ATEX product design
Re: New low-end CH32V microcontrollers from WCH
« Reply #5 on: May 23, 2024, 11:07:38 pm »
Interesting family.
The 006 includes a 005 32k/6k variant, that comes down to QFN12 (2x2p0.4mm)
The 006 shows QFN32 but no TQFP32 ?

The 004 comes in only TSSOP20/QFN20 so is upgrade to 003.
The 002 (16k/4k) also comes in QFN12 and SO16N and SO8

Often dropped in the low end parts is a crystal oscillator, but I see these all have Xtal support, and even the QFN12 and SO8 pin out the crystal.
That opens up many logic replacement simple timing chain uses.

They appear to not have any 32.768kHz crystal support  ? 
Maybe they decide it is not a super low power usage part ?
I typically would like to see high precision RC built in these smaller MCUs.
What's even your use case for the crystal?

Also I can finally see these parts at JLC.  The 003. Maybe then I can use them for a personal project.
 

Offline HwAoRrDkTopic starter

  • Super Contributor
  • ***
  • Posts: 1527
  • Country: gb
Re: New low-end CH32V microcontrollers from WCH
« Reply #6 on: May 23, 2024, 11:09:35 pm »
RISC-V GCC has supported -march=rv32im -mno-div since at least 2018. But, yes, now there's an official extension for it.

I presume the effect would be the same as specifying Zmmul?
 

Offline PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: au
Re: New low-end CH32V microcontrollers from WCH
« Reply #7 on: May 24, 2024, 12:26:51 am »
Also I can finally see these parts at JLC.  The 003. Maybe then I can use them for a personal project.
The 003 is looking like a 'test the waters' part, with these newer, wider supply parts more mainstream.
eg the older 003 lacks the 40kHz OSC option, and the 128kHz WDOG osc has an improved Icc spec.

I also see the Xtal Osc has more gain on the new parts, maybe they had issues ?
Crystals keep getting smaller, but that usually also means higher ESR.

I typically would like to see high precision RC built in these smaller MCUs.
Vendors have differing ideas of what 'high precision' means.
The new WCH part is not too bad, it has a 40kHz, 8.5uA OSC, with claimed  TA = -40℃~85℃ -3%~+2.5 %  (after calibration)
The older 003 has only the 128kHz, low current, but no stability specs at all.

Silabs are rather better, their LFRCO is 32.768 nominal, +/- 3%  (VT unclear)  and draws just 175nA


What's even your use case for the crystal?
These little MCUs are cheap enough to compete with logic, parts like HC4060, or 74HC5555 (now EOL) or even tiny logic parts like 74AHC1G42xx, but they need similar oscillator choices to replace the logic.

If you needed 'better than RC precision', that meant you were bumped to a bigger package around TSSOP20/QFN20
A xtal amplifier is also useful if you need a TCXO with clipped sine output.
Those are often cheaper and more widely available than CMOS TXCO.



 

 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4107
  • Country: nz
Re: New low-end CH32V microcontrollers from WCH
« Reply #8 on: May 24, 2024, 02:28:44 am »
RISC-V GCC has supported -march=rv32im -mno-div since at least 2018. But, yes, now there's an official extension for it.

I presume the effect would be the same as specifying Zmmul?

https://godbolt.org/z/oGTbs4Gsj
 
The following users thanked this post: HwAoRrDk

Offline SiliconWizard

  • Super Contributor
  • ***
  • Posts: 14682
  • Country: fr
Re: New low-end CH32V microcontrollers from WCH
« Reply #9 on: May 24, 2024, 03:56:00 am »
Yes, that's exactly the same. -mno-div existed way before Zmmul was defined, but soon enough the need to support a hardware mulitplier but no hardware division emerged. The original M extension included both multiplication and division. As I remember, strictly speaking, if you didn't implement division, you weren't compliant with the M extension, at the time. At least that's what I remember from the initial specs.
 

Offline brucehoult

  • Super Contributor
  • ***
  • Posts: 4107
  • Country: nz
Re: New low-end CH32V microcontrollers from WCH
« Reply #10 on: May 24, 2024, 08:46:43 am »
As I remember, strictly speaking, if you didn't implement division, you weren't compliant with the M extension, at the time. At least that's what I remember from the initial specs.

You must implement all instructions you claim to support in the ISA string, but for this purpose M-mode firmware is considered to be part of the hardware platform. Trap-and-emulate is legal for whatever instructions you don't want to implement in hardware.

Of course if you overdo that then performance is going to suffer, but that's between you (the core designer) and your customers, not between you and RISC-V International.

For example lots of cores -- probably the majority -- don't implement unaligned load/store in hardware, but this is required to be supported in all RISC-V implementations in User mode and System mode.

Accordingly, the standard OpenSBI implements trap-and-emulate for unaligned load/store. This code can be present on all machines, if that's convenient, because if a machine implements unaligned load/store in hardware then the emulation routines will never be hit. Or, you as a hardware designer could decide to implement unaligned load/store within a 64 byte cache block, but not spanning cache blocks. Or you could support spanning cache blocks, but not spanning VM pages. Or whatever you want. Whatever traps (if anything) will get emulated.
 

Online tszaboo

  • Super Contributor
  • ***
  • Posts: 7492
  • Country: nl
  • Current job: ATEX product design
Re: New low-end CH32V microcontrollers from WCH
« Reply #11 on: May 24, 2024, 09:04:18 am »
Also I can finally see these parts at JLC.  The 003. Maybe then I can use them for a personal project.
The 003 is looking like a 'test the waters' part, with these newer, wider supply parts more mainstream.
eg the older 003 lacks the 40kHz OSC option, and the 128kHz WDOG osc has an improved Icc spec.

I also see the Xtal Osc has more gain on the new parts, maybe they had issues ?
Crystals keep getting smaller, but that usually also means higher ESR.

I typically would like to see high precision RC built in these smaller MCUs.
Vendors have differing ideas of what 'high precision' means.
The new WCH part is not too bad, it has a 40kHz, 8.5uA OSC, with claimed  TA = -40℃~85℃ -3%~+2.5 %  (after calibration)
The older 003 has only the 128kHz, low current, but no stability specs at all.

Silabs are rather better, their LFRCO is 32.768 nominal, +/- 3%  (VT unclear)  and draws just 175nA


What's even your use case for the crystal?
These little MCUs are cheap enough to compete with logic, parts like HC4060, or 74HC5555 (now EOL) or even tiny logic parts like 74AHC1G42xx, but they need similar oscillator choices to replace the logic.

If you needed 'better than RC precision', that meant you were bumped to a bigger package around TSSOP20/QFN20
A xtal amplifier is also useful if you need a TCXO with clipped sine output.
Those are often cheaper and more widely available than CMOS TXCO.
They have built in high speed RC. For logic gate replacement, you can use a pin change interrupt and sleep while waiting for anything to happen. You can typically divide down the built in RC to any value you really want. Also, the crystals are expensive, compared to the price of these chips. And if you want a small design, then even a 2016 crystal with the bypassing capacitor will take up more board space then the chip itself.
I see two reason to use a crystal oscillator in a simple project ( there are a lot more). You need timekeeping of course. The other is in case a communication interface needs it to be accurate enough. There are some ST chips that will do USB connection without crystals now.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf