www.geehy.com Page 251
Note:
(
1
)
RXEN bit cannot be reset during data receiving period; otherwise, the bytes being received will
be lost.
(
2
)
In the process when the receiver is receiving a data frame, if overrun error, noise error or
frame error is detected, the error flag will be set to 1.
(
3
)
When data is transferred from the shift register to USART_RXDATA register, the RXBNEFLG
bit of USART_STS will be set by hardware.
(
4
)
An interrupt will be generated if RXBNEIEN bit is set.
(
5
)
In single buffer mode, the RXBNEFLG bit can be cleared by reading USART_RXDATA
register by software or by writing 0.
(
6
)
In multi-buffer mode, after each byte is received, RXBNEFLG bit of USART_STS register will
be set to 1, and DMA will read the data register to clear it.
21.4.4.2
Break frame
When the receiver receives a break frame, USART will handle it as receiving a
frame error.
21.4.4.3
Idle frame
When the receiver receives an idle frame, USART will handle it as receiving an
ordinary data frame; if IDLEIEN bit of USART_CTRL1 is set, an interrupt will be
generated.
21.4.4.4
Select the clock source
The clock source must be selected by clock control system before USART is
enabled
(
1
)
The clock source is selected according to the transmission speed and
the possibility of use of USART in low-power mode.
(
2
)
The clock source frequency is f
CK
.
The range of communication speed is determined by the clock source.
USART should be enabled before the clock source is selected.
When USART adopts dual clock domain or wakes up the stop mode,
PCLK, LSECLK, HSICLK or SYSCLK can be the clock source;
otherwise, the clock source is PCLK.
If LSECLK and LSICLK are selected as the clock source, USART can
receive data even in low-power mode. And it can select according to
the received data and wake-up mode, and wake up MCU when
necessary, so that DMA can read the received data.
The receiver realizes the data recovery of different oversampling
technologies configured by users to distinguish valid incoming data
and noises, which requires a trade-off between the maximum
communication speed and noise/clock inaccuracy immunity.
21.4.4.5
Oversampling rate
OSMCFG bit of USART_CTRL1 register determines the oversampling rate.
If the oversampling rate is 8 times of the baud rate, the speed is higher, but the
clock tolerance is smaller. If it is 16 times, the speed is lower, but the clock
tolerance is bigger.
21.4.4.6
Overrun error
When RXBNEFLG bit of USART_STS register is set to 1 and a new character is