20.4.2.4 Smart Card

The UART module supports communication with ISO 7816 smart cards. In a typical application, the UART module is intended to act as the host or terminal that always initiates communication transactions. The smart card acts as a client and always responds to commands and other stimuli from the terminal. Figure 20-15 shows a smart card subsystem using a microcontroller with a UART module for smart card data communication.

The terminal is also responsible for powering, clocking and resetting the smart card. The clock can be sourced by using the REFO output pin, and the Reset signal can be implemented with a general purpose output. The system is based on a half-duplex single wire, requiring the UART UxTX and UART UxRX pins to be shorted externally and pulled to VDD with a weak pull-up.

The module can be configured to support either block (T = 1) or byte (T = 0) protocol. Block mode is set up for a predetermined message block size, whereas Byte mode transmits one byte at a time.

Upon detection of the card insertion, the terminal pulls the Reset line low to initiate a Reset sequence. The smart card responds with an Answer-to-Reset (ATR), which contains parameters used for communication details. The ATR baud rate is predetermined at the REFO clk/372. The terminal will need to be configured for this baud rate at the time the Reset pulse is sent to the smart card. Typical REFO clock rates are 1 MHz to 5 MHz. See ISO 7816 for additional details on ATR.

Note: Protocol characteristics, electrical characteristics of the smart card, Answer-To-Reset (ATR), PPS (Protocol Parameter Selection), calculation of guard time and wait times are out of the scope for this data sheet. Please refer to the licensed version of the ISO 7816-3 document for details about smart card communication.
Figure 20-15. Smart Card Subsystem
Note: Use a general purpose input to detect insertion of a smart card.