|
| 1 | +# picoISP Programmer for AVR MCU based on CH552E |
| 2 | +The CH55x-based picoISP is a simple and cheap ISP programmer for AVR microcontrollers with voltage selection switch (5V and 3.3V) and compatible with the [USBtinyISP](https://learn.adafruit.com/usbtinyisp). It works fine with AVRdude (avrdude -c usbtiny) and the Arduino IDE (Tools -> Programmer -> USBtinyISP). The firmware is based on Dick Streefland's and Ladyada's original implementation and DeqingSun's CH55x conversion. |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | +# Hardware |
| 7 | +## Schematic |
| 8 | + |
| 9 | + |
| 10 | +## CH552E 8-bit USB Device Microcontroller |
| 11 | +The CH552E 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 CH552E has a factory built-in bootloader so firmware can be uploaded directly via USB without the need for an additional programming device. |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +# Compiling and Installing Firmware |
| 17 | +## Installing Toolchain for CH55x |
| 18 | +Install the [CH55x Software Development Kit for the SDCC compiler](https://github.com/Blinkinlabs/ch554_sdcc). Follow the instructions on the website. In order for the programming tool and the I²C-Bridge software to work, Python3 must be installed on your system. To do this, follow these [instructions](https://www.pythontutorial.net/getting-started/install-python/). In addition [PyUSB](https://github.com/pyusb/pyusb) must be installed. On Linux (Debian-based), all of this can be done with the following commands: |
| 19 | + |
| 20 | +``` |
| 21 | +sudo apt install sdcc python3 python3-pip |
| 22 | +sudo pip install pyusb |
| 23 | +``` |
| 24 | + |
| 25 | +## Installing Drivers for the CH55x Bootloader |
| 26 | +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: |
| 27 | + |
| 28 | +``` |
| 29 | +echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="4348", ATTR{idProduct}=="55e0", MODE="666"' | sudo tee /etc/udev/rules.d/99-ch55x.rules |
| 30 | +sudo service udev restart |
| 31 | +``` |
| 32 | + |
| 33 | +On Windows you will need the [Zadig tool](https://zadig.akeo.ie/) to install the correct driver for both, the CH55x bootloader and the CDC device. Click "Options" and "List All Devices" to select the USB module, then install the libusb-win32 driver. |
| 34 | + |
| 35 | +## Entering CH55x Bootloader Mode |
| 36 | +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. |
| 37 | + |
| 38 | +## Compiling and Uploading Firmware |
| 39 | +Open a terminal and navigate to the folder with the makefile. 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 picoisp.bin```. |
| 40 | + |
| 41 | +# Operating Instructions |
| 42 | +- Select the programming voltage (3.3V or 5V) with the voltage selection switch. |
| 43 | +- Plug the picoISP into a USB port on your PC, it should be identified as a USBtinyISP. |
| 44 | +- Connect the picoISP to the target board via the 6-pin ICSP connector. |
| 45 | +- Windows users may need to install a driver (https://learn.adafruit.com/usbtinyisp). |
| 46 | +- The picoISP should work with any IDE or programming software that supports the USBtinyISP programmer. |
| 47 | + |
| 48 | +# References, Links and Notes |
| 49 | +1. [EasyEDA Design Files](https://oshwlab.com/wagiminator) |
| 50 | +2. [WCH: CH552 Datasheet](http://www.wch-ic.com/downloads/CH552DS1_PDF.html) |
| 51 | +3. [SDCC Compiler](https://sdcc.sourceforge.net/) |
| 52 | +4. [Blinkinlabs: CH55x SDK for SDCC](https://github.com/Blinkinlabs/ch554_sdcc) |
| 53 | +5. [Dick Streefland: USBtiny](https://dicks.home.xs4all.nl/avr/usbtiny/) |
| 54 | +6. [Ladyada: USBtinyISP](https://learn.adafruit.com/usbtinyisp) |
| 55 | +7. [Deqing Sun: CH55xduino](https://github.com/DeqingSun/ch55xduino) |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +# License |
| 60 | + |
| 61 | + |
| 62 | +This work is licensed under Creative Commons Attribution-ShareAlike 3.0 Unported License. |
| 63 | +(http://creativecommons.org/licenses/by-sa/3.0/) |
0 commit comments