The CH55x-based picoAVR is an ISP, TPI, and UPDI combo programmer for AVR microcontrollers compatible with the USBasp and SerialUPDI. It works fine with the Arduino IDE (Tools -> Programmer -> USBasp / Tools -> Programmer -> SerialUPDI). This combo programmer includes a target voltage selection switch that allows users to choose between 5V and 3.3V for their project needs.
The CH552G is a low-cost, enhanced E8051 core microcontroller compatible with the MCS51 instruction set. It has an integrated USB 2.0 controller with full-speed data transfer (12 Mbit/s) and supports up to 64 byte data packets with integrated FIFO and direct memory access (DMA). The CH552G has a factory built-in bootloader so firmware can be uploaded directly via USB without the need for an additional programming device.
On Linux you do not need to install a driver. However, by default Linux will not expose enough permission to upload your code with the USB bootloader. In order to fix this, open a terminal and run the following commands:
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="4348", ATTR{idProduct}=="55e0", MODE="666"' | sudo tee /etc/udev/rules.d/99-ch55x.rules
sudo service udev restart
For Windows, you need the CH372 driver. Alternatively, you can also use the Zadig Tool to install the correct driver. Here, click "Options" -> "List All Devices" and select the USB module. Then install the libusb-win32 driver. To do this, the board must be connected and the CH55x must be in bootloader mode.
A brand new chip starts automatically in bootloader mode as soon as it is connected to the PC via USB. Once firmware has been uploaded, the bootloader must be started manually for new uploads. To do this, the board must first be disconnected from the USB port and all voltage sources. Now press the BOOT button and keep it pressed while reconnecting the board to the USB port of your PC. The chip now starts again in bootloader mode, the BOOT button can be released and new firmware can be uploaded within the next couple of seconds.
Install the SDCC Compiler. In order for the programming tool to work, Python3 must be installed on your system. To do this, follow these instructions. In addition pyusb must be installed. On Linux (Debian-based), all of this can be done with the following commands:
sudo apt install build-essential sdcc python3 python3-pip
sudo pip install pyusb
- Open a terminal.
- Navigate to the folder with the makefile.
- Connect the board and make sure the CH55x is in bootloader mode.
- Run
make flash
to compile and upload the firmware. - If you don't want to compile the firmware yourself, you can also upload the precompiled binary. To do this, just run
python3 ./tools/chprog.py picoavr.bin
.
Install the Arduino IDE if you haven't already. Install the CH55xduino package by following the instructions on the website.
- Adjust the firmware parameters in src/config.h if necessary.
- Copy the .ino and .c files as well as the /src folder together into one folder and name it picoavr.
- Open the .ino file in the Arduino IDE.
- Go to Tools -> Board -> CH55x Boards and select CH552 Board.
- Go to Tools and choose the following board options:
- Clock Source: 16 MHz (internal)
- Upload Method: USB
- USB Settings: USER CODE /w 0B USB RAM
- Connect the board and make sure the CH55x is in bootloader mode.
- Click Upload.
On Linux, you don't need to install a driver. The implementation includes Windows Compatible ID (WCID) code for automated driver installation on Windows. If this doesn't work, Windows users may need to install a driver manually using the Zadig tool (https://zadig.akeo.ie/). Click on "Options" -> "List all devices" and select the USBasp. Then install the libusb-win32 driver. Now select the SerialUPDI and install the CDC driver. To do this, the picoAVR must be connected to your PC.
- Select the programming voltage (3.3V or 5V) with the voltage selection switch.
- Plug the picoAVR into a USB port on your PC, it should be identified as a USBasp with an additional CDC COM port.
- Connect the picoAVR to the target board via the 6-pin ICSP connector or the 3-pin UPDI connector.
- The picoAVR should work with any IDE or programming software that supports the USBasp and/or SerialUPDI programmer.
- EasyEDA Design Files
- WCH: CH552 Datasheet
- SDCC Compiler
- Blinkinlabs: CH55x SDK for SDCC
- Thomas Fischl: USBasp
- Ralph Doncaster: USBasp
- Deqing Sun: CH55xduino
This work is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License. (http://creativecommons.org/licenses/by-sa/3.0/)