New Part Day: The Twenty Five Cent USB Microcontroller (With A Toolchain!)

Last year, Jiangsu Yuheng Co., Ltd introduced a new microcontroller. The CH554 is a microcontroller with an E8051 core with a 24 MHz clock, a little more than 1 kB of RAM, and a bit more than 14 kB split between the code and data Flash. In short, it’s nothing too spectacular, but it makes up for that with peripherals. It’s got SPI and ADCs and PWM, UARTs, and even a few capacitive touch channels. It’s also a USB device, with some chips in the series able to function as a USB host. You can buy this chip for a quarter through the usual retailers.

Normally, this isn’t huge news. The 8051 is the most copied microcontroller on the planet, and there are probably billions produced each year. Cheap parts are only cheap if your time is free; you’ll usually spend ages trying to digest the datasheet and get a toolchain up and running. That’s where this chip is a little different. There are multiple efforts to bring an Open Source toolchain to this chip. And they’re doing it in Windows and Linux. Someone really cares about this chip.

The current best option for an SDK for this chip comes from Blinkinlabs, with a port of the CH554 SDK from Keil to SDCC. There are real, working code examples for this chip using an Open Source toolchain. Sure, it might just blink a LED, but it’s there. If you can blink a LED, you can do just about anything from there. Programming the chip happens over USB with the ‘official’ WCHISPTool (Windows) or LibreCH551 (command line). The end result is a completely Open Source toolchain to program and upload a hex file to a cheap chip.

There are a few more chips in the CH554 series, ranging from the CH551 in an SOP-16 package to the CH559 in an LQFP48 package, with more features available as the chips get bigger. It’s an interesting chip, with some somehow implementing a USB hub, and could be a very cool chip for some low-level USB hacking.

40 thoughts on “New Part Day: The Twenty Five Cent USB Microcontroller (With A Toolchain!)

    1. Yes, this. This is exactly what makes the difference with other chip manufacturers (I won´t give name):
      Leveraging the open.source tools and creating ready-to-use toolchains that don´t constrain one to use a particular software. It seems the success of the ESP8266 has interesting ripples over other manufacturers.
      Espressif initially was not interested to support the development of an opensource toolchain, but when the community adopted the chip because it was interesting in itself, and spend efforts developing one, Espressif changed their mind, saw the opportunity of having a huge user base quickly, and contributed to opening the chip (or at least most of it).

      1. Still no source code for the wifi driver though.

        But for WCH they could start by publishing their datasheets in English, the Blinkenlabs guys had to translate the datasheet from chinese to english for the ch554, the ch552 datasheet in english is still missing.

  1. Google translated without editing. It is actually readable and make sense!?

    > Enhanced E8051 core CPU, 8-15 times faster than the standard MCS51, special XRAM data fast copy instructions;

    > Built-in 14KB Code Flash, 2KB BootLoader, support USB and serial ISP;

    > Built 1KB XRAM internal and 256B iRAM; 128 bytes DataFlash, supports byte read;

    > Inline 6-channel capacitance detection module, supporting up to 15 touch buttons, supporting independent timing interrupt;

    > Embedded USB controller and USB transceiver, support USB2.0 full speed and low speed host or device mode. Supports up to 64 bytes of data packets, built-in FIFO, and supports DMA;

    > Support USB Type-C master-slave detection, level control or configure the power supply, to achieve power management Type-C;

    > Provide 3 groups of timers/counters, support 2 channels of signal capture and 2 channels of PWM output;

    > Provide 2 full-duplex asynchronous serial ports, all support high baud rate communication, UART0 is standard MCS51 serial port;

    > Provide 1 SPI communication interface, built-in FIFO, support master/slave mode;

    > Provide 4-channel 8-bit ADC analog-to-digital converter to support voltage comparison;

    > Built-in 24MHz clock source and PLL, also can choose external crystal;

    > Package: TSSOP20, MSOP10 and SOP16;

    1. Electrodragon has USB boards: https://www.electrodragon.com/product/ch552-ch554-mini-dev-board-ch55x-series/

      Not too interesting.
      If you are after a board with USB and the usual peripherals, and if you’re not on an extremely tight budget, get a nRF52840 dongle. This one has 1MB Flash, and can even run Micropython, which greatly shortens your development times.
      You’ll have the typical DIY sensor/display/actor applications up and running in minutes rather than days.

      If you’re developing <2$ electronic toys, then the CH55x are probably your weapon of choice.

      1. $0.60 at 10pcs volume.
        I tried to order their entire 36 piece inventory at that price, but they said they only had 32 of the $1.12 “G” version.
        The translated datasheet was missing some important sections and others were jibberish in English.

  2. This is the cheapest I found
    https://lcsc.com/search?q=ch554
    Could someone link the $0.25 source Brian’s talking about?
    Obviously, you wouldn’t risk designing a company building product around it, but it sounds like great value, to tinker with.
    I found a similar Microchip part with excellent documentation and support, but it was $1.21 at 100pc volumes.
    I guess this CH554 part is most interesting to the open source fan-boys?

  3. https://lcsc.com/products/WCH_11013.html carry them. The prices aren’t that great.
    CH551 $0.4194 QTY1
    CH552 $0.5682
    CH554 $0.9200 and goers up from there.

    At these prices, I can SiLabs EFM8UB1x chips from Digikey or other distributors.
    EFM8UB10F8G-C-QFN20R (8K FLASH) $0.63789 US at QTY 1
    EFM8UB10F16G-C-QFN20R (16K FLASH) $0.92138 US

    They come with a “free” IDE (with licensed Keil 8051 compiler) with datasheet in English, software library, technical support and hardware emulator (need a $30 evalboard).

    1. While these new chips do have a couple of interesting features (for example touch sensing), they generally read worse than the EFM8UB10 chips (which can also be overclocked to 48MHz if you want a bit more ‘oomph’), even before considering the documentation and support issues.
      I’ll certainly be sticking with the Silabs devices, mainly using the QFN20 as it’s nice and small and very cheap for what you get (I’d like to migrate to some of the low-cost “chip-scale” packages available for ARM cores but they’re either a pitch that results in more manufacturing cost or simply not available)

    1. Most of the D10s at Digikey are in the one-dollar+ range. These ones that you’ve found are significantly cheaper, but there are only 480 in stock and it’s a special order to get more.

      Do they really have built-in hardware USB? Host mode?

      I think these are apples / oranges in a sense.

      1. Wouldn’t it make more sense to compare apples to apples pricing as well? LCSC is like a Jameco not a Digikey.
        D10 pricing at sources more reliable than Jameco but less sketchy than LCSC (Quest) is half Digikey.

    1. USB host on a *8051* with only 1kB of RAM and 14kB of FLASH is kinda pointless as it can’t get too far. You pretty much have to hard coded it for a very specific USB device and hope the rest of your application fits.

      8051 also has a very low code density (with compiled C) compared to other microcontroller.

  4. In my experience, programming an 8051 in c with the sdcc compiler is a constant battle. Any non-trivial code quickly grows beyond the size that fits within the 8051’s internal address spaces, and you end up either playing linker games or throwing in the towel and switching to very code-inefficient access modes for everything. A line of source code that should be 3 machine instructions ends up being several dozen. Maybe sdcc is able to use this “enhanced” 8051’s instructions, but it isn’t a particularly clever compiler to begin with.

    1. I remembering trying to compile TI’s sample code (targeted for IAR) and it basically unable to fit. The IAR code does a lot of clever things to get it down to size. The SDCC compiled code is 2-3 times and won’t fit the device. 8051 already have very low code density and having a not very optimized compile makes it worse.

      Last time I played with SDCC, it would not take advantage of anything beyond the basic model 8051. You are on your own if you want to use those extensions.
      e.g. A simple external memory to memory copy normally is a 2-3 instructions tight loop becomes a 20+ instructions if your chip or compiler don’t support additional dptr (16-bit register).

Leave a Reply to Aaron ChristophelCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.