AT32F425
Series Reference Manual
2022.03.30
Page 153
Ver 2.01
12.8.2 Receiver configuration
Configuration procedure:
1. USART enalbe: UEN bit is set.
2. Full-
duplex/half-duplex configuration: Refer to full-duplex/half-duplex selector for more information.
3. Mode
configuration: Refer to mode selector for more information.
4. F
rame format configuration: Refer to frame format for more information.
5. In
terrupt configuration: Refer to interrupt generation for more information.
6. Reception using DMA:
If the DMA mode is selected, the DMAREN bit is set, and configure DMA
register accordingly.
7. Baud
rate configuration: Refer to baud rate generation for details.
8. Receiver
enable: REN bit is set.
Character repeption:
The RDBF bit is set. It indicates that the content of the shift register is transferred to the RDR
(Receiver Data Register). In other words, data is received and can be read (including its
associated error flags)
An interrupt is generated when the RDBFIEN is set.
The erro flag is set when a framing error, noise error or overrun error is detected during
reception.
In DMA mode, the RDNE bit is set after every byte is received, and it is cleared when the data
register is read by DMA.
In non-DMA mode, the RDBF bit is cleared when read access to the USART_DT register by
software. The RDBF flag can also be cleared by writing 0 to it. The RDBF bit must be cleared
before the end of next frame reception to avoid overrun error.
Break frame reception:
Non-LIN mode: It is handled as a framing error, and the FERR is set. An interrupt is generated if
the corresponding interrupt bit is enabled. Refer to framing error decribed below for details.
LIN mode: It is handled as a break frame, and the BFF bit is set. An interrupt is generated if the
BFIEN is set.
Idle frame reception:
It is handled as a data frame, and the IDLEF bit is set. An interrupt is generated if the IDLEIEN is
set.
When a framing error occurs:
The FERR bit is set.
The USART receiver moves the invalid data from the receive shift register to the receive data
buffer.
In non-DMA mode, both FERR and RDBF are set at the same time. The latter will generate an
interrupt. In DMA mode, an interrupt is generated if the ERRIEN.
When an overrun error occurs:
The ROERR bit is set.
The data in the receive data buffer is not lost. The previous data is still available when the
USART_DT register is read.
The content in the receive shift register is overwritten.Afterwards, any data received will be lost.
An interrupt is generated if the RDBFIEN is set or both ERRIEN and DMAREN are set.
The ROERR bit is cleared by reading the USART_STS register and then USART_DT register in
order.
Note: If ROERR is set, it indicates that at least one piece of data is lost, with two possibilities: