AT32F425
Series Reference Manual
2022.03.30
Page 149
Ver 2.01
─
Noise error
─
Parity error
12.2
Full-duplex/half-duplex selector
The full-duplex and half-duplex selector enables USART to perform data exchanges with peripherals in
full-duplex or half-duplex mode, which is achieved by setting the corresponding registers.
In two-wire unindirectional full-duplex mode (by default), TX pin is used for data output, while the RX pin
is used for data input. Since the transmitter and receiver are independent of each other, USART is
allowed to send/receive data at the same time so as to achieve full-duplex communication.
When the HALFSEL is set 1, the single-wire bidirectional half-duplex mode is selected for communication.
In this case, the LINEN, CLKEN, SCMEN and IRDAEN bits must be set 0. RX pin is inactive, while TX
and SW_RX are interconnected inside the USART. For the USART part, TX pins is used for data output,
and SW_RX for data input. For the peripheral part, bidirectional data transfer is executed through IO
mapped by TX pin.
12.3
Mode selector
12.3.1 Introduction
USART mode selector allows USART to work in different operation modes through software
configuration so as to enable data exchanges between USART and peripherals with different
communication protocols.
USART supports NRZ standard format (Mark/Space), by default. It also supports LIN (Local
Interconnection Network), IrDA SIR (Serial Infrared), Asynchronous Smartcard protocol in ISO7816-3
standard, RS-232 CTS/RTS (Clear To Send/Request To Send) hardware flow operation, silent mode and
synchronous mode, depending on USART mode selection configuration.
12.3.2 Configuration procedure
Selection of operation mode is done by following the configuration process listed below. In addition, such
configuration method, along with those of receiver and transmitter described in the subsequent sections,
are used to make USART initialization configuration.
1.
LIN mode: While LINEN bit is set 1, CLKEN, STOPBN[1: 0], SCMEN, SLHDEN, IRDAEN and DBN
bits are all set 0. 11-bit or 12-bit break frame detection depends on whether the BFBN bit is set 1 or
0. When the SBF bit is set 1, the 13-bit low-level LIN synchronous break frame is transmitted.
2.
Smartcard mode: SCMEN bit is set 1, LINEN, SLHDEN and IRDAEN bits are 0, DBN and PEN bits
are set 1, and STOPBN[1: 0]=11. The polarity, phase and pulse number of the clock can be
configured by setting the CLKPOL, CLKPHA and LBCP bits (Refer to Synchronous mode for details).
The SCGT[7: 0] bit is used to select protection time. The SCNACKEN bit is used to select whether
to send NACK when a parity error occurs.
3.
Infrared mode: IRDAEN is set 1, and the CLKEN, STOPBN[1: 0], SCMEN and SLHDEN bits are all
0. Set the IRDALP bit enables infrared low-power mode, and configures the desired low-power
frequency in conjunction with the ISDIV[7:0].
4.
Hardware flow control mode: Setting the RTSEN and CTSEN bit will enable RTS and CTS flow
control, respectively.
5.
RS485 mode: This mode is enabled by setting RS485EN=1. The enable signal is output on the RTS
pin. The DEP bit is used to select the polarity of the DE signal. The TSDT[4: 0] bit is used to define
the latency before the transmission of the start bit on the transmitter side, while the TCDT[4: 0] is
used to define the latency before the TC flag is set following the stop bit at the end of the last data.
6.
Silent mode: When the RM bit is set, silent mode is entered. When the WUM bit is set 1 or 0, it wakes
up from silent mode through ID match and idle bus, respectively. The ID[7: 0] is configurable. Select
ID[7: 0] or ID[3: 0] by setting the IDBN bit. When ID match is selected, if the MSB of data bit is set,
it indicates that the current data stands for ID.
When parity check is disabled, if DBN1,DBN0=10, the MSB refers to the USART_DT[6]; if
DBN1,DBN0=00, the MSB refers to the USART_DT[7]; if DBN1,DBN0=01, the MSB stands for