![Geehy SEMICONDUCTOR APM32F030x4x6x8xC Скачать руководство пользователя страница 254](http://html1.mh-extra.com/html/geehy-semiconductor/apm32f030x4x6x8xc/apm32f030x4x6x8xc_user-manual_573629254.webp)
www.geehy.com Page 253
(
4
)
DTCL: Deviation caused by transmission line
Baud Rate Generator
The baud rate division factor (USARTDIV) is a 16-digit number consisting of
12-digit integer part and 4-digit decimal part. Its relationship with the system
clock:
Baud rate=PCLK/16×(USARTDIV)
The system clock of USART2/3 is PCLK1, and that of USART1 is PCLK2.
USART can be enabled only after the clock control unit enables the system
clock.
Automatic Baud Rate Detection
When a character is received, USART can detect and automatically set the value
of the USART_BR register. Automatic baud rate detection is conducted when the
communication speed of the system is unknown, when the clock source with low
precision is used, or when the clock deviation is not measured to obtain the
correct bit rate. The clock source must be compatible with the expected
communication speed.
A non-zero baud rate must be written for initialization; confirm the character
content, and then turn on automatic baud rate detection. ABRDCFG bit of
USART_CTRL2 register can be set to select the character content, and the
possible character content is:
(
1
)
For all characters starting with 1, in this case, measure the length of the
start bit (the duration from the falling edge to the rising edge).
(
2
)
For all characters starting with 10xx, in this case, measure the length of
the start bit and the first data bit, the duration of the falling edge, to
ensure better accuracy when the signal slew rate is small.
ABRDEN bit of USART_CTRL2 register determines whether to turn on automatic
baud rate detection. After the automatic baud rate detection is turned on, wait for
the first character on RX line. After detection, ABRDFLG flag bit of USART_STS
register will be set.
Note:
(
1
)
If the line noise is too high, correct baud rate cannot be guaranteed. In this case, the BR value
may be damaged and the ABRDEFLG flag bit will be set. This situation can also happen if the
communication speed and automatic baud rate detection is not compatible.
(
2
)
RXBNEFLG interrupt will be generated after detection.
(
3
)
At any time, automatic baud rate detection may be restarted by resetting the ABRDFLG flag
(writing a 0).
(
4
)
USART cannot be disabled during automatic baud rate detection; otherwise, the BR value
may be damaged.
Multi-processor Communication
In multi-processor communication, multiple USARTs are connected to form a
network. In this network, two devices communicate with each other, and the
mute mode can be enabled for other devices not participating in the
communication in order to reduce the burden of USART. In mute mode, HDEN
bit of USART_CTRL3 register is cleared, no receive state bit will be set, and all
receive interrupts are disabled.