HT32 MCU UART Application Note
AN0609EN V1.00 3 / 23 June 23, 2022
Each part of the UART data packet is introduced in order below.
Start Bit: This indicates the start of a data packet. The UART TX pin usually remains at a high
logic level before transmission starts. If data transmission starts, the UART transmitter will pull
the TX pin from high to low, i.e., from 1 to 0, and then hold it there for one clock cycle. The UART
receiver will start reading data when a high to low transition has been detected on the RX pin.
Data: This is the actual data transferred, with a data length of 7, 8 or 9 bits. The data is usually
transferred with the LSB first.
Parity Bit: The number of logic “1” in the data is used to determine whether any data has changed
during transmission. For even parity, the total number of logic “1” in the data should be an even
number, conversely, the total number of logic “1” in the data should be an odd number for odd
parity.
Stop Bit: This indicates the end of a data packet, where the UART transmitter will pull the TX
pin from low to high, i.e., from 0 to 1, and then hold it there for a 1 or 2-bit time period.
As mentioned before, since there is no clock signal in the UART circuit, the same serial data
transmitting/receiving speed, which is known as the baud rate, must be defined between the
transmitter and receiver to implement error-free transmission. The baud rate is defined by the
number of bits transferred per second, in bps (bit per second). Some standard and commonly used
baud rates are 4800bps, 9600bps, 19200bps, 115200bps, etc. The corresponding time required for
transferring a single data bit is shown below.
Table 1. Baud Rate vs. 1-Bit Transmission Time
Resource Download and Preparation
This chapter will introduce the application code and the software tool used, as well as how to
configure the directory and file path.
Firmware Library
First, ensure that the Holtek HT32 firmware library has been downloaded before using the application
code. The download link is shown below. Here there are two options, HT32_M0p_Vyyyymmdd.zip
for the HT32F5xxxx series and HT32_M3_Vyyyymmdd.zip for the HT32F1xxxx series. Download
and unzip the desired file.
The zip file contains several folders that can be classified as Document, Firmware Library, Tools
and other items, the placement path of which is shown in Figure 5. The HT32 firmware library zip
file with a file name of HT32_STD_xxxxx_FWLib_Vm.n.r_s.zip is located under the
Firmware_Library folder.