GD32A50x User Manual
484
During USART transmission, if a parity error event is detected, the smartcard may NACK the
current frame by pulling down the TX pin during the last 1 bit time of the stop bits. The USART
can automatically resend data according to the protocol for SCRTNUM times. An interframe
gap of 2.5 bits time will be inserted before the start of a resented frame. At the end of the last
repeated character the TC bit is set immediately without guard time. The USART will stop
transmitting and assert the frame error status if it still receives the NACK signal after the
programmed number of retries. The USART will not take the NACK signal as the start bit.
During USART reception, if the parity error is detected in the current frame, the TX pin is
pulled low during the last 1 bit time of the stop bits. This signal is the NACK signal to smartcard.
Then a frame error occurs in smartcard side. The RBNE/receive DMA request is not activated
if the received character is erroneous. According to the protocol, the smartcard can resend
the data. The USART stops transmitting the NACK and the error is regarded as a parity error
if the received character is still erroneous after the maximum number of retries which is
specified in the SCRTNUM bit field. The NACK signal is enabled by setting the NKEN bit in
USART_CTL2.
The idle frame and break frame are not supported in the Smartcard mode.
Block (T=1) mode
In block (T=1) mode, the NKEN bit in the USART_CTL2 register should be cleared to
deactivate the NACK transmission.
When requesting a read from the smartcard, the RT[23:0] bits in USART_RT register should
be programmed with the BWT (block wait time) - 11 value and RBNEIE must be set. A timeout
interrupt will be generated, if no answer is received from the card before the expiration of this
period. If the first character is received before the expiration of the period, it is signaled by the
RBNE interrupt. If DMA is used to read from the smartcard in block mode, the DMA must be
enabled only after the first character is received.
In order to allow the automatic check of the maximum wait time between two consecutive
characters, the USART_RT register must be programmed to the CWT (character wait time) -
11 value, which is expressed in baudtime units, after the reception of the first character (RBNE
interrupt). The USART signals to the software through the RT flag and interrupt (when RTIE
bit is set), if the smartcard doesn’t send a new character in less than the CWT period after the
end of the previous character.
The USART uses a block length counter, which is reset when the USART is transmitting
(TBE=0), to count the number of received characters. The length of the block, which must be
programmed in the BL[7:0] bits in the USART_RT register, is received from the smartcard in
the third byte of the block (prologue field). This register field must be programmed to the
minimum value (0x0), before the start of the block, when using DMA mode. With this value,
an interrupt is generated after the 4th received character. The software must read the third
byte as block length from the receive buffer.
In interrupt driven receive mode, the length of the block may be checked by software or by