Nations Technologies Inc.
Tel
:
+86-755-86309900
:
Address: Nations Tower, #109 Baoshen Road, Hi-tech Park North.
Nanshan District, Shenzhen, 518057, P.R.China
462
/
631
to the USART_DAT register. During single-byte communication, no interrupt framing error will be generated because
it occurs with USART_STS.RXDNE and the hardware will generate an interrupt when the USART_STS.RXDNE
flag is set. In multi-buffer communication mode, an interrupt will be generated if the USART_CTRL3.ERRIEN bit
is set.
Overrun error
When USART_STS.RXDNE is still '1', when the data currently received in the shift register needs to be transferred
to the RDR register, an overflow error will be detected, and the hardware will set USART_STS.OREF. When this bit
is set, the value in the RDR register is not lost, but the data in the shift register is overwritten. It is cleared by a
software sequence (read USART_STS register first, then write USART_DAT register).
When an overflow error occurs, USART_STS.RXDNE is '1', and an interrupt is generated. If the
USART_CTRL3.ERRIEN bit is set, an interrupt will be generated when the USART_STS.OREF flag is set in multi-
buffer communication mode.
Noise
error
USART_STS.NEF is set by hardware when noise is detected on a received frame. It is cleared by software sequence
(read USART_STS register first, then write USART_DAT register). During single-byte communication, no noise
interrupt generated because it occurs with USART_STS.RXDNE and the hardware will generate an interrupt when
the USART_STS.RXDNE flag is set. In multi-buffer communication mode, an interrupt is generated when the
USART_STS.NEF flag is set if the USART_CTRL3.ERRIEN bit is set.
Table 22-2 Data sampling for noise detection
Sample value
NE status
Received bits
Data validity
000
0
0
Effective
001
1
0
be invalid
010
1
0
be invalid
011
1
1
be invalid
100
1
0
be invalid
101
1
1
be invalid
110
1
1
be invalid
111
0
1
Effective
Generation of fractional baud rate
The baud rate of the USART can be configured in the USART_BRCF register. This register defines the integer and
fractional parts of the baud rate divider. The baud rate of the transmitter and receiver should be configured to the
same value. Be careful not to change the value of the USART_BRCF register during communication, because the
baud rate counter will be replaced by the new value of the baud rate register.
TX / RX baud rate =
𝑓
PCLK
/(16
∗
USARTDIV)
where
𝑓
PCLK
is the clock provided to the peripheral:
PCLK1 is used for USART2, USART3, up to 27MHz;