|
WCH CH559: A Powerful Enhanced 8-bit USB Microcontroller

WCH CH559: A Powerful Enhanced 8-bit USB Microcontroller

In today’s rapidly developing embedded systems, microcontrollers (MCUs) play a crucial role. The CH559 chip from WCH (Nanjing Qinheng Microelectronics) is an enhanced 8-bit USB microcontroller that combines high-performance processing capability with rich peripheral features, making it highly competitive in various application scenarios.

1. CH559 Features

The CH559 is a microcontroller based on the E8051 core, compatible with the MCS51 instruction set. Its key features include:

  • High-speed processing: 79% of instructions are single-byte single-cycle instructions, with average instruction speed 8-15 times faster than standard MCS51.

  • Powerful storage: Built-in 64KB Flash-ROM (usable for program or data storage), 256B on-chip iRAM, and 6KB on-chip xRAM. Part of the xRAM supports DMA direct memory access.

  • Rich peripherals: Including ADC analog-to-digital converter, 4 timer/PWM groups, dual asynchronous serial ports, dual SPI interfaces, and a dual-port Root-HUB supporting USB Host and Device modes.

  • USB functionality: Built-in USB controller and dual USB transceivers, supporting USB 2.0 Full-speed (12Mbps) and Low-speed (1.5Mbps). Supports control, bulk, interrupt, and isochronous transfers. In USB Host mode, it can manage two USB devices simultaneously.

  • Clock: Built-in 12MHz clock, supports external crystal oscillator, and provides USB clock and system clock via PLL.

  • Power management: Built-in 5V to 3.3V LDO, supports low-power sleep mode, and can be woken by USB, UART, SPI, and some GPIOs.

2. Comparison with Same Series Chips

WCH offers multiple 8-bit USB MCUs, including CH558 and CH554. Compared to these chips, the CH559 shows significant improvements in features and performance:

Feature/ModelCH559CH558CH554
CoreE8051E8051E8051
USB ModeSupports USB Host and Device dual modes, dual-port Root-HUBDevice mode onlySupports Low-speed and Full-speed USB Host/Device
Program Storage64KB Flash-ROM (program or data storage)40KB ROM16KB
RAM256B on-chip iRAM, 6KB on-chip xRAM, partial xRAM supports DMA4K+256B1K+256B
PeripheralsADC, 4 timer/PWM groups, dual async serial ports, dual SPI interfaces, dual-port Root-HUB with USB Host/Device supportADC, timer, PWM, SPIADC, touch keys, timer, PWM, UART, SPI
USB SpeedUSB 2.0 Full-speed (12Mbps) and Low-speed (1.5Mbps)USB 2.0 Full-speed (12Mbps) and Low-speed (1.5Mbps)USB 2.0 Full-speed (12Mbps) and Low-speed (1.5Mbps)
ClockBuilt-in 12MHz clock, external crystal support, PLL for USB and system clocksBuilt-in 12MHz clock, external crystal support, PLL for USB and system clocksBuilt-in 12MHz clock, external crystal support
Main ApplicationsUSB devices, USB Host applications, industrial control, IoT, consumer electronicsUSB devicesLow-cost USB applications like USB mice, keyboards, etc.

3. Main Applications and Target Markets

With its powerful features and flexibility, the CH559 is suitable for various application scenarios:

  • USB devices: For example, USB mice, keyboards, USB drives, etc.

  • USB Host applications: For connecting and controlling other USB devices, such as reading data from USB storage devices in embedded systems.

  • Industrial control: For data acquisition, device control, and communication.

  • IoT (Internet of Things): As the core controller for smart home devices, sensor networks, etc.

  • Consumer electronics: For various consumer electronic products requiring USB interfaces.

4. Development Resources and Technical Support

WCH provides comprehensive development resources and technical support for the CH559, including:

  • Datasheet: Detailed chip specifications, register descriptions, and electrical characteristics.

  • ISP download tool: WCHISPTool_Setup.exe for downloading programs via USB or serial port.

  • Examples: C language sample programs to help developers get started quickly.

  • Development boards: Schematic and PCB files for development boards, convenient for hardware design.

  • Technical support: WCH provides online technical and sales support to solve problems developers encounter.

  • FAT file system library: Provides a FAT file system library for convenient data storage operations.

5. CH559 Pin Characteristics

Pin No. (LQFP48)Pin NameAlternate Function (Left-first priority)Description
1P1.5AIN5/MOSIDefault P1 port I/O, configurable as analog input channel 5, or SPI0 master output pin.
2P1.6AIN6/MISO1Default P1 port I/O, configurable as analog input channel 6, or SPI1 slave input pin.
3P1.7AIN7/SCK1Default P1 port I/O, configurable as analog input channel 7, or SPI1 clock pin.
4P5.7RSTDefault P5 port I/O, configurable as reset input pin.
5P3.0RXD4Default P3 port I/O, configurable as UART4 receive pin, function may depend on other configuration registers.
6P4.4LED3/TNOW*/TXD1*/A46Default P4 port I/O, configurable as LED control pin 3, timer input, UART1 transmit pin, or address bus A46 pin, function may depend on other configuration registers.
7P3.1TXD7Default P3 port I/O, configurable as UART7 transmit pin, function may depend on other configuration registers.
8P3.2LED0/INT0Default P3 port I/O, configurable as LED control pin 0, or external interrupt 0 input pin.
9P3.3LED1/!A15/INT1Default P3 port I/O, configurable as LED control pin 1, address bus A15 pin, or external interrupt 1 input pin.
10P3.4LEDC/XCS0/T0Default P3 port I/O, configurable as LED control clock pin, external bus chip select 0, or timer 0 input.
11P3.5DA6/T1Default P3 port I/O, configurable as DAC channel 6 output pin, or timer 1 input pin.
12P3.6WRDefault P3 port I/O, configurable as external bus write enable pin.
13P3.7RDDefault P3 port I/O, configurable as external bus read enable pin.
14P4.3PWM1_/A3Default P4 port I/O, configurable as PWM1 inverted output pin, or address bus A3 pin.
15P4.2PWM3*/CAP3*/A2Default P4 port I/O, configurable as PWM3 inverted output pin, timer 3 capture input, or address bus A2 pin.
16P4.6XI/SCS_Default P4 port I/O, configurable as external crystal input, or SPI slave chip select pin.
17P4.7XO/SCK_Default P4 port I/O, configurable as external crystal output, or SPI clock pin.
18GNDVSSGround.
19P4.1A1Default P4 port I/O, configurable as address bus A1 pin.
20P4.0LED2/A0/RXD1_Default P4 port I/O, configurable as LED control pin 2, address bus A0 pin, or UART1 inverted receive pin.
21P2.0A8Default P2 port I/O, configurable as address bus A8 pin.
22P2.1MOSI1/A9Default P2 port I/O, configurable as SPI1 master output, or address bus A9 pin.
23P2.2MISO1/A10Default P2 port I/O, configurable as SPI1 slave input, or address bus A10 pin.
24P2.3SCK1/A11Default P2 port I/O, configurable as SPI1 clock pin, or address bus A11 pin.
25P2.4PWM1/A12Default P2 port I/O, configurable as PWM1 output pin, or address bus A12 pin.
26P2.5TNOW/PWM2/A13/T2EX*/CAP2*Default P2 port I/O, configurable as timer input, PWM2 output, address bus A13 pin, timer 2 external clock input, or timer 2 capture input pin.
27P2.6RXD1/A14Default P2 port I/O, configurable as UART1 receive pin, or address bus A14 pin.
28P2.7TXD1/DA7/A15Default P2 port I/O, configurable as UART1 transmit pin, DAC channel 7, or address bus A15 pin.
29P5.5HP/!A15/XADefault P5 port I/O, in USB Host mode as USB HUB1 port HP pin, or inverted address bus A15 pin, or RS485 differential input XA pin.
30P5.4HM/ALE/XBDefault P5 port I/O, in USB Host mode as USB HUB1 port HM pin, or address latch enable ALE, or RS485 differential input XB pin.
31P5.1DPDefault P5 port I/O, in USB mode as USB data line DP pin.
32P5.0DMDefault P5 port I/O, in USB mode as USB data line DM pin.
33P0.7AD7/UDCDDefault P0 port I/O, configurable as analog-to-digital conversion input channel 7, or USB data connection detect pin.
34P0.6AD6/URIDefault P0 port I/O, configurable as analog-to-digital conversion input channel 6, or USB RI pin.
35P0.5AD5/UDSRDefault P0 port I/O, configurable as analog-to-digital conversion input channel 5, or USB DSR pin.
36P0.4AD4/UCTSDefault P0 port I/O, configurable as analog-to-digital conversion input channel 4, or USB CTS pin.
37P0.3AD3/TXD_Default P0 port I/O, configurable as analog-to-digital conversion input channel 3, or UART0 inverted transmit pin.
38P0.2AD2/RXD_Default P0 port I/O, configurable as analog-to-digital conversion input channel 2, or UART0 inverted receive pin.
39P0.1AD1/URTSDefault P0 port I/O, configurable as analog-to-digital conversion input channel 1, or USB RTS pin.
40P0.0AD0/UDTRDefault P0 port I/O, configurable as analog-to-digital conversion input channel 0, or USB DTR pin.
41VIN55V external power input, powers the internal 5V-to-3.3V LDO, requires external 0.1uF decoupling capacitor.
42VDD33VDD/VCCInternal regulator output and internal 3.3V operating power input. When supply voltage is less than 3.6V, connect VIN5 to external power. When supply voltage is greater than 3.6V, requires external 3.3uF decoupling capacitor.
43P1.0AIN0/T2/CAP1Default P1 port I/O, configurable as analog input channel 0, timer 2 input, or timer 2 capture input pin.
44P1.1AIN1/T2EX/CAP2Default P1 port I/O, configurable as analog input channel 1, timer 2 external clock input, or timer 2 capture input pin.
45P1.2AIN2/PWM3/CAP3Default P1 port I/O, configurable as analog input channel 2, PWM3 output pin, or timer 3 capture input pin.
46P1.3AIN3Default P1 port I/O, configurable as analog input channel 3.
47P1.4AIN4/SCSDefault P1 port I/O, configurable as analog input channel 4, or SPI0 slave chip select pin.
48P4.5PWM2_/A5Default P4 port I/O, configurable as PWM2 inverted output pin, or address bus A5 pin.

Pin characteristics summary:

  • Power and ground: CH559 has independent power input (VIN5) and 3.3V operating voltage output (VDD33), as well as ground (GND) pins.

  • GPIO: P0, P1, P2, P3, P4, P5 ports are all general-purpose input/output ports, with P0-P3 ports bit-addressable.

  • Analog input: The P1 port provides 8 ADC analog input channels AIN0~AIN7 for analog signal acquisition.

  • USB:

P5.0 and P5.1 are used for USB data lines DM and DP, supporting USB Host and Device modes.

  • P5.4 and P5.5 are used for USB Host’s expansion HUB1 HM and HP pins, for connecting external USB devices.

Timer/PWM: Multiple pins have timer input/output or PWM output functions, such as P1.0, P1.1, P1.2, P2.4, P2.5. UART: Multiple UART communication pins are provided, including P0.2 (RXD*), P0.3 (TXD*), P2.6 (RXD1), P2.7 (TXD1). SPI: SPI communication pins include P1.4 (SCS), P1.5 (MOSI), P1.6 (MISO), P1.7 (SCK) for SPI0, and P2.1, P2.2, P2.3 for SPI1. Reset: P5.7 (RST) is the reset pin. Crystal: P4.6 (XI) and P4.7 (XO) are for connecting external crystal oscillators.

6. Application Cases

Here are some CH559 application cases, highlighting its USB Host and Device capabilities:

  • USB Host applications:

USB keyboard/mouse control: CH559 can serve as the main controller of an embedded system, connecting USB keyboards and mice through the USB Host interface for human-machine interaction. For example, it can be used to control industrial equipment or kiosks.

  • USB data acquisition: CH559 can connect USB storage devices (such as USB drives), read data from them, and transfer the data to other devices or for further processing. For example, for data logging or firmware updates.

USB Device applications:

  • USB virtual serial port: CH559 can emulate a USB serial device, communicating with a PC through the USB interface, convenient for debugging and data transfer.

  • USB HID device: CH559 can implement USB HID (Human Interface Device) devices, such as USB game controllers, transmitting sensor data to a computer via USB.

Summary

The CH559 is a feature-complete, high-performance 8-bit USB microcontroller with high-speed processing capability, rich peripheral resources, and flexible USB Host/Device functionality. It has broad application prospects in industrial control, IoT, consumer electronics, and other fields. Meanwhile, WCH’s comprehensive development resources and technical support make it easier for developers to create various innovative applications with the CH559.

Hope this blog article is helpful to you!