Sunday 10 May 2020

Getting started with the CH55x Microcontroller

I have not been hiding the fact that I have love for the CH55x range of microcontrollers. So much so that I decided to stock several versions on the store. If you want to get hold of a few to experiment with check it out at Rabid's Electronics Emporium

I thought it's about time to write up a little tutorial on how to get up and running with this little unsung hero.

For this getting started tutorial I will be specifically looking at the CH552G but this tutorial will also apply for the CH551x, CH552x and CH554.

Installing the Toolchain 

This is not the only way to set up this toolchain there are other compilers and toolchains available, this, however, was the most straightforward way I found to get up and running.

First off the best thing to do is to install the compiler for this tutorial. We are going to use SDCC (Small Device C Compiler) this compiler runs natively in most linux flavours but if you're developing on a windows machine like I am then it will be worth setting up WLS (Windows Linux Subsystem) and installing Ubuntu.

Details on how to do that can be found here:

Once you are at the Linux command line SDCC can be installed with:

apt-get install sdcc build-essential

The next step will be to download the codebase for SDCC and the CH554 from GitHub:

git clone 
Then navigate into the examples and compile them:

cd ch554_sdcc/examples/
 If this completes correctly then your toolchain is setup.
You should have something similar to above.

After a little searching around, there is a way to setup SDCC in windows natively which can be found at the link below.

As I mentioned I didn't use this method but if you feel a little more comfortable using it instead of installing WSL and Ubuntu it's worth a shot.

Preparing the hardware 

The MCU itself requires very little hardware to run in USB programming mode. Though a reasonable soldering skill is needed to solder the chip into a proto-board. There are many tutorials online on the best method to do this.

The above video is a very similar method to what I use. I am also considering stocking some already soldered on the store, as I will soon have the prototyping boards available.  

Once you have your board soldered and pins attached the rest of the circuit can be made up, on a breadboard. For me, I found the easiest way to attach the USB signal was to Butcher an old USB cable and solder Dupont jumper wire onto the exposed ends.

This has been really handy while I have experimented with this MCU.

The rest of the supporting circuitry can be made up, on a breadboard all it requires is 2 x 100nF ceramic capacitors between 3v3 and GND and between VCC and GND as down below.

If the chip is new and fresh from the factory then from my experience it drops straight into bootloader mode no a widows PC it makes the always familiar USB device sound :).

Of course, if this doesn't happen then the MCU will need to be set into bootloader mode.

Putting the MCU into USB Bootloader mode

There are two possible bootloader pins ton the CH552 the default from the factory is on P3.6. To active the bootloader the pin must be pulled to 3V3 briefly after reset. This can, however, be very problematic as the same pin is shared with USB DP. So for my purposes, I like to set up the bootloader pin as the available alternative which is P1.5 there is a catch though this pin ins needed to be pulled to GND.

Writing Firmware to the MCU 

First of all, you will need to download and install WCHISPTool this is the official and poorly translated to English tools from WCH themselves. 

This can be downloaded from here:

Oddly enough the English WCH site doesn't give you any of the download links to the tools of datasheets so you will have to go through the Chinese site. 

once the software is installed and running it will look much like the above. You will need to select the '8-Bit CH55x series' tab and select the CH552 as you devise then all being well your device should appear in the device list below. 

 This tool gives you a few configuration options like:
  • Disabling the reset pin 
  • Enabling slow reset
  • Erasing the data flash 
  • Swapping the bootloader pin to P1.5
From my own experience swapping the bootloader pin is worth doing for me it helps getting it into bootloaders mode as P3.6 (the default pin) is shared with USB Data + which cam make things awkward. Where you have P1.5 tied to GND was very helpful for me as the MCU then automatically goes into USB bootloader mode every time it is reset or powered. 

To test the function everything is well if you select the user firmware you would like to use I used blink which but this point should be in the toolchain examples.

This will need to be selected as your 'User file' the click on Download(D) all being well you will have some lovely green text in the download record below saying the process was successful.

All being well if you hook and LED and resistor between pin P1.7 and GND then you will have a lovely blinky LED.

Starting your own application

This is very simple from mine I copied one of the examples and I started to edit form and just use the make command to compile it.

After a bit of trail and error managed to make it run LPD8806 strips of LEDs.

Messy but works :D

What I would like to do now is to add a USB CDC driver so I am able to adjust the colours over USB.

I have a both the CH552G and CH552T which has more IO are listed on my Tindie store.

Further Info on the CH552 can be found here:


Improved Pinout table


  1. You can pullup UDP using a 10K resistor, and it won't interfere with USB communications. The Electrodragon CH55x modules have a jumper for this.

    Regarding the P1.5 bootloader option, when that is enabled does it enter the bootloader even after reset (when RST is pulled up to VCC), or only after a power cycle. The default UDP pullup to enter the bootloader only works after a power cycle.

    If you update to the latest ch554_sdcc, you don't have to run the WCHISPTOOL gui to flash the chip. You can use a commandline tool like ch552tool.

  2. If you are using a CH554, and the USB Host, then a connected full-speed peripheral would cause the CH554 to enter bootloader on power-up and/or reset... That's nice to have this alternate way to enter the bootloader - I was searching for this option, and just found your site. Very useful, thank you.

  3. Am able to program CH552 using the WCHISPStudio software without a problem but CH554 is not recognized despite using the wiring shown at https://i.stack.imgur/D4grM.jpg. Have adjusted the pin connections to account for the different CH554 pinout. Anyone have a suggestion for a circuit to program the CH554? Perhaps using the serial port in place of USB. Can email response to