1. Introduction
Recently, I received the AI8H2K12U microcontroller sent by STC company. According to its datasheet, this microcontroller has built-in USB to serial port firmware, and it does not require USB driver installation. Furthermore, it can be paired with an external power control circuit and can work with STC’s ISP software to form the programming circuit for STC microcontrollers. These functions are all built into the microcontroller, including USB to serial port. This allows it to be directly used in USB serial communication. Below is the circuit design for initial testing of its functions.

▲ Figure 1.1 Ai8H2K USB Downloader Function
2. Test Results
1. Test Circuit
We designed a test circuit. This circuit includes a microcontroller in SOP8 package, a Type-C USB interface, and a serial output interface. The circuit board was designed to be suitable for a one-minute board-making method.
▲ Figure 1.2.1 Test Schematic
▲ Figure 1.2.2 Test PCB
Using the one-minute board-making method, we obtained the test circuit board. The circuit board was soldered and cleaned. Now, we proceed with the testing.

We connected the Type-C USB cable to the Type-C socket. An unknown USB device appeared in the Windows Device Manager. This indicates that the microcontroller is not recognized by the computer. Does this mean that there is no USB corresponding program inside the microcontroller at this time?

Upon checking the circuit diagram, I found that the external connection of the microcontroller’s third pin with the 0.1 microfarad capacitor was missing the filter capacitor. I added a 0.1 microfarad capacitor to modify the circuit board. For convenience, I directly soldered a 0.1 microfarad capacitor between the third and fourth pins of the chip. Let’s test again.

Reconnecting the USB circuit, we can see that the computer has recognized a new virtual serial port corresponding to COM17. In the subsequent tests, we will change this port number to COM8.

2. Serial Communication
Next, we measured the serial output signal from the microcontroller with an oscilloscope. Using the host computer, we opened the serial port and sent the character 0x55. We could see the data signal waveform sent by the microcontroller. Interestingly, the pin that should output a high level only showed around 2.8V, and the subsequent output data matched the data corresponding to 0x55. Finally, when the data output stop bit was reached, the output pin seemed to enter a high-impedance state. Therefore, it is best to have a pull-up resistor at the microcontroller’s serial transmission end to ensure that the serial port outputs a high level when idle, avoiding interference to the receiving end.

USB to dual serial port, supports a maximum baud rate of 10Mbps. Comes with USB to serial port program, no USB driver installation required.
Ai8H2K12U-45MHz-SOP8, USB to serial port, RMB0.95. Ai8H2K12U-45MHz-SOP16, USB to dual serial port, RMB1.1. It can also control power on/off automatically, fully automatic ISP download programming. P3.5 is low-level conduction power supply, P5.4 is high-level conduction power supply. To save the isolation tube used for programming, the default send pin is set to open-drain after sending, resulting in high impedance, meaning no power supply capability to the outside, which saves one isolation diode.
To upgrade or modify settings, in AIapp-ISP-V6.94U and above version software, select the 【Programming】 menu | 【Update USB-2UART+HID control chip】.
▲ Figure 1.2.3 You can configure the TXD pin status through the ISP tool.
Next, we measure the function of the chip forming the download circuit. For pin P5.4, which is originally used to control the target board power supply, we connected an external LED in the test circuit board. We can see that when pressing the detection button in the ISP software, the LED turns off for 0.5 seconds and then returns to high level. This indicates that the serial port inside the microcontroller can correctly recognize the ISP software’s download preamble data and can control the external power switch circuit.


※ Conclusion ※
This article provides a preliminary test of the AI8H2K12U microcontroller’s USB to serial port function. It has a default program that allows it to be used directly as a USB to serial port chip. Additionally, the internal program can recognize ISP download data, enabling the creation of STC microcontroller download circuit boards. This makes the development of STC microcontrollers very simple, almost akin to self-development. It is truly hard to find such an easy-to-use microcontroller.
STC?USB: https://zhuoqing.blog.csdn.net/article/details/140300121