![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 445](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794445.webp)
GD32E23x User Manual
445
To detect the idle line, the RTEN bit in the USART_CTL1 register and the RTIE in the
USART_CTL0 register must be set. The USART_RT register must be set to the value
corresponding to a timeout of 2 characters time. After the last stop bit is received, when the
receive line is idle for this duration, an interrupt will be generated, informing the software that
the current block reception is completed.
In the ModBus/ASCII mode, the end of a block is recognized by a specific (CR/LF) character
sequence. The USART manages this mechanism using the character match function by
programming the LF ASCII code in the ADDR field and activating the address match interrupt
(AMIE=1). When a LF has been received or can check the CR/LF in the DMA buffer, the
software will be informed.
16.3.14.
Receive FIFO
The receive FIFO can be enabled by setting the RFEN bit of the USART_RFCS register to
avoid the overrun error when the CPU can’t serve the RBNE interrupt immediately. Up to 5
frames receive data can be stored in the receive FIFO and receive buffer. The RFFINT flag
will be set when the receive FIFO is full. An interrupt is generated if the RFFIE bit is set.
Figure 16-16. USART receive FIFO structure
Rx shift
register
Rx Module
FIFO 0
FIFO 1
Rx FIFO EN
Rx Buffer
DMA
FIFO 2
FIFO 3
If the software read receive data buffer in the routing of the RBNE interrupt, the RBNEIE bit
should be reset at the beginning of the routing and set after all of the receive data is read out.
The PERR/NERR/FERR/EBF flags should be cleared before reading a receive data out.
16.3.15.
Wakeup from Deep-sleep mode
The USART is able to wake up the MCU from Deep-sleep mode by the standard RBNE
interrupt or the WUM interrupt.
The UESM bit must be set and the USART clock must be set to IRC8M or LXTAL (refer to the
reset and clock unit RCU section).
When using the standard RBNE interrupt, the RBNEIE bit must be set before entering
Deep-sleep mode.
When using the WUIE interrupt, the source of WUIE interrupt may be selected through the