Has RISC-V finally made the 8051 obsolete?

8051 (MCS-51)

You can probably tell from the tone of the title that I'm no fan of the 8051. The 8051 is an 8-bit MCU created by Intel in 1980. It has a very simple (aka wimpy) instruction set that was designed to minimize the amount of silicon required. This and the fact that the IP of the 8051 was released as free to the public, made it a popular choice as the CPU core of MCUs from a variety of vendors. Taken from a purely hardware point of view, the 8051 seems like a great way to make low cost MCUs, but from a software developers POV (e.g. mine), it's a productivity killing choice. The reasons I feel this way are:

  • The HW architecture has so many odd quirks and limitations that your code ends up being a specialized mess that has no hope of portability to any other architecture
  • 8-bit ops mean that your code becomes very bulky to do actual work besides blinking some LEDs
  • What you save in HW cost, you pay dearly for in SW cost
  • The available SW tools are very limited (e.g. SDCC - C compiler, 8051 assembler)
  • The lack of stack/RAM space means that imaging, wireless protocols and anything remotely complicated, when written for the 8051, will be a complicated mess

Besides all of these negatives, it continues to be used in modern designs because it helps reduce the cost of the final product.

Cannibalizing Your Products

Any large company which continuously develops long-lived, diversified products will eventually cannibalize their own in order to innovate. It appears that WCH is now doing so with their RISC-V MCUs overtaking their 8051 MCUs and even selling them at a lower cost. For the last few weeks, I've been creating various PCBs for their new CH32X03x line of MCUs (33/34/35). This is a series of low cost RISC-V MCUs that feature native USBFS (device+host) and USBPD support. They're an order of magnitude more powerful than the CH5xx series and cost less! Price and availability of this new series has been a bit uneven, but judging by the cost from the same marketplace (e.g. AliExpress), the CH32X series will remain lower cost compared to the CH5xx series. Here's a quick list of the differences:

CH32X035
48Mhz 32-bit RISC-V
20K SRAM
62K FLASH + 3K bootloader
USBFS + USBPD
Vcc 2.7 to 5.5V
ADC w/capacitive touch support
The usual assortment of UART/I2C/SPI/GPIO/Timers

CH559 (the most powerful one)
56Mhz 8-bit 8051
6.25K SRAM
63K FLASH
USBFS
Vcc 3.3 to 5V
The usual assortment of UART/I2C/SPI/GPIO/ADC/Timers

The CH559 currently costs about twice as much as the CH32X for a similar package (number of exposed pins).

Through the features and pricing, it certainly appears that WCH wants you to use the CH32X instead of the CH5xx. A similar story can be seen with the ubiquitous CH340 series. A CH32X can do the same job (USB-CDC to UART) at lower cost. The CH32V203 is priced about the same as the CH559, yet is even more powerful than the CH32X035.

I've been experimenting with the CH32X033 (purchased on AliExpress for 23 cents each) and have been impressed with how well it works. One thing to note is that the first batch of shipping chips has a defect in a few of the I/O lines of GPIO port A which prevents hardware I2C from working. The GPIO lines are usable for output and input, but the internal pull-up and pull-down resistors don't work. Hopefully this is resolved in the next batch.

I'll update this with new info if a newer batch fixes the problem...


Comments

Popular posts from this blog

How much current do OLED displays use?

Fast SSD1306 OLED drawing with I2C bit banging

Building the Pocket CO2 Project