GD32A50x User Manual
483
19.3.11.
Half-duplex communication mode
The half-duplex communication mode is enabled by setting the HDEN bit in USART_CTL2.
The LMEN, CKEN bits in USART_CTL1 and SCEN, IREN bits in USART_CTL2 should be
cleared in half-duplex communication mode.
Only one wire is used in half-duplex mode. The TX and RX pins are connected together
internally. The TX pin should be configured as IO pin. The conflicts should be controlled by
the software. When the TEN bit is set, the data in the data register will be sent.
19.3.12.
Smartcard (ISO7816-3) mode
The smartcard mode is an asynchronous mode, which is designed to support the ISO7816-3
protocol. Both the character (T=0) mode and the block (T=1) mode are supported. The
smartcard mode is enabled by setting the SCEN bit in USART_CTL2. The LMEN bit in
USART_CTL1 and HDEN, IREN bits in USART_CTL2 should be reset in smartcard mode.
A clock is provided to the smartcard if the CKEN bit is set. The clock can be divided for other
use.
The frame consists of 1 start bit, 9 data bits (1 parity bit included) and 1.5 stop bits.
The smartcard mode is a half-duplex communication protocol. When connected to a
smartcard, the TX pin must be configured as open drain mode, and drives a bidirectional line
that is also driven by the smartcard.
Figure 19-15. ISO7816-3 frame format
0
1
2
3
4
5
6
7
0
1
2
3
4
5
6
7
0.5 bit
1 bit
S
S
ISO 7816-3 frame without parity error
ISO 7816-3 frame with parity error
P
P
Character (T=0) mode
Compared to the timing in normal operation, the transmission time from transmit shift register
to the TX pin is delayed by half baud clock, and the TC flag assertion time is delayed by a
guard time that is configured by the GUAT[7:0] bits in USART_GP. In Smartcard mode, the
internal guard time counter starts counting up after the stop bits of the last data frame, and
the GUAT[7:0] bits should be configured as the character guard time (CGT) in ISO7816-3
protocol minus 12. The TC status is forced reset while the guard time counter is counting up.
When the counter reaches the programmed value TC is asserted high.