
AT32F413
Series Reference Manual
2022.06.27
Page 144
Rev 2.00
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 to 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 that of receiver and transmitter described in the subsequent sections,
are used to make USART initialization configuration.
1.
LIN mode:
Parameters configuration: LINEN=1, CLKEN=0, STOPBN[1: 0]=0, SCMEN=0, SLHDEN=0,
IRDAEN=0 and DBN=0.
LIN master has break fram transmission capability, and thus it is able to send 13-bit low-level LIN
synchronous break frame by setting SBF=1.
Similarily, LIN slave has break frame detection capability, and thus it is able to detect 11-bit or 10-bit
break fame, depending on whether BFBN=1 or BFBN=0.
2.
Smartcard mode:
Parameters configuration: SCMEN=1, LINEN=0, SLHDEN=0, IRDAEN=0, CLKEN=1, DBN=1,
PEN=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 assertion of the TDC flag can be delayed by setting the SCGT[7: 0] bit (guard time bit). The TDF
bit can be asserted high after the guard time counter reaches the value programmed in the SCGT[7:
0] bit.
The Smartcard is a single-wire half duplex communication protocol. The SCNACKEN bit is used to
select whether to send NACK when a parity error occurs. This is to indicate to the Smarcard that the
data has not been correctly received
3.
Infrared mode:
Parameters configuration: IRDAEN=1, CLKEN=0, STOPBN[1: 0]=0, SCMEN=0 and SLHDEN=0.
The infrared low-power mode can be enabled by setting IRDALP=1. In normal mode the transmitted
pulse width is specified as 3/16 bit. In infrared low-power mode, the pulse width can be configurable.
And the ISDIV[7:0] bit can be used to achieve the desired low-power frequency.