GD32F20x User Manual
491
STB[1:0]
stop bit length (bit)
usage description
11
1.5
Smartcard mode for transmitting and receiving
In an idle frame, all the frame bits are logic 1. The frame length is equal to the normal USART
frame.
A break frame is configured number of low bits followed by the configured number of stop
bits.The transfer speed of a USART frame depends on the frequency of the PCLK, the
configuration of the baud rate generator and the oversampling mode.
19.3.2.
Baud rate generation
The baud-rate divider is a 16-bit number consisting of a 12-bit integer and a 4-bit fractional
part. The number formed by these two values is used by the baud rate generator to determine
the bit period. Having a fractional baud-rate divider allows the USART to generate all the
standard baud rates.
The baud-rate divider (USARTDIV) has the following relationship to the peripheral clock:
USARTDIV=
PCLK
16×Baud Rate
(19-1)
The peripheral clock is PCLK2 for USART0/5 and PCLK1 for USART1/2 and UART3/4/6/7.
The peripheral clock must be enabled through the clock control unit before enabling the
USART.
19.3.3.
USART transmitter
If the transmit enable bit (TEN) in USART_CTL0 register is set, when the transmit data buffer
is not empty, the transmitter shifts out the transmit data frame through the TX pin. The polarity
of the TX pin can be configured by the TINV bit in the USART_CTL3 register. Clock pulses
can be output through the CK pin.
After the TEN bit is set, an idle frame will be sent. The TEN bit should not be reset while the
transmission is ongoing.
After power on, the TBE bit is high by default. Data can be written to the USART_DATA when
the TBE bit of the USART_STAT0 register is asserted. The TBE bit is cleared by a writing to
the USART_DATA register and will be set by hardware after the data is put into the transmit
shift register. If a data is written to the USART_DATA register while a transmission is ongoing,
it will be firstly stored in the transmit buffer, and transferred to the transmit shift register after
the current transmission is done. If a data is written to the USART_DATA register while no
transmission is ongoing, the TBE bit will be cleared and set soon, because the data will be
transferred to the transmit shift register immediately.
If a frame is transmitted and the TBE bit is asserted, the TC bit of the USART_STAT0 register
will be set. An interrupt is generated if the corresponding interrupt enable bit (TCIE) is set in
the USART_CTL0 register.
Summary of Contents for GD32F20 Series
Page 191: ...GD32F20x User Manual 191 Bits Fields Descriptions 31 0 TRNDATA 31 0 32 Bit Random data ...
Page 290: ...GD32F20x User Manual 290 conversion is ongoing ...
Page 325: ...GD32F20x User Manual 325 15 0 ALRM 15 0 RTC alarm value low ...
Page 385: ...GD32F20x User Manual 385 ...
Page 523: ...GD32F20x User Manual 523 clears AERR bit by writing 0 to it ...