...the world's most energy friendly microcontrollers
2014-01-23 - an0820_Rev1.00
11
www.silabs.com
a fixed length and a data field with variable length. Many of the messages consists only of the header.
Since the implementation in this application note only implements the T=0 protocol, the data field in the
USB messages typically map directly to the APDU-message going to/from the smart card.
A detailed description of the CCID standard is outside the scope of this document. For detailed
description of the CCID Class Descriptor, exact message format, status/error codes and sequence
diagrams, please refer to the specification, (Reference 1 (p. 20) ). An overview of some
implementation details, state-diagrams and sequence diagrams are given later in this chapter.
3.2 Connection of Smart Card to the STK
The EFM32 peripheral used for the physical layer is the USART which has a special 7816 smart card
mode to make the T=0 error detection and retransmission happen in hardware. An additional clock signal
is also required for the card, which is generated using a timer. As the serial communication is a single
line, half duplex, both the TX and the RX pins of the interface are tied together to the smart card I/O line,
this is done internally in the EFM32, using the loop back feature of the asynchronous serial interface.
According to ISO-7816 part 3, the nominal bit duration used on the I/O line is defined as one Elementary
Time Unit (ETU) and the initial ETU is 1/9600 s. For simplicity reasons, only the 9600 bps speed is
implemented. Further the bytes are transmitted using 8 data bits, 1 bit even parity and 1.5 stop bits, as
this matches the required format of the 7816 standard.
USART1 in asynchronous mode is used and TIMER0 provides the required clock signal. The clock
frequency is fixed to 3.5712 MHz which is the baud rate multiplied by 372. This is the default factor of
difference between baud rate and clock speed in the 7816 standard.
Further there is a reset pin and power pins allocated as well as a card-insertion detection pin. The 7816
standard defines that the card reader should physically power off the card if ordered to do so by the
host or if card-removal is detected.
The insertion detection pin is usually a separate electrical switch within the smart card socket. It is not
connected directly to the smart card. It is usually a normally closed switch, which opens when a smart
card is inserted all the way in the socket. In this example it is connected to both EFM32 GND and a
gpio-pin with a pull-up. When a card is inserted and the switch breaks the connection, it is expected that
this pin is pulled up. Therefore make sure to connect the other side of the insertion detection switch of
the card socket to EFM32-ground, not the GND pin of the smart card, as this can be tri-stated when
the card is not inserted.
All the pins used are located on the STK3700 expansion header, the exact pins used are described by
the following table:
Table 3.1. STK3700 Smart Card Pinout Description
EFM32GG990F1024
Smart Card Pin
Functionality
PD2
C3
CLK
Clock
PD0
C7
I/O line
TX/RX Serial Data
PD5
C2
Reset
Card reset
PD3
C1
V
cc
Card Power Supply
1
PD4
C5
GND
Ground pin of card
PD1
Insertion Detection
Insertion Detect Pin, high
side
GND
Insertion Detection
Insertion Detect Pin, low
side
1
In this application example, a GPIO pin is used directly as the card power supply, hence the card Vcc is limited to 3.3V. For 5V
cards, the same application can be used with GPIO pin driving a hardware switch that provides Vcc=5V to the card.
Summary of Contents for EFM32
Page 27: ......