Anda di halaman 1dari 4

Ping Wu ', Wen Du, Huijuan

Cui

State Key Lab on Microwave and Digital Communications, Department of Electronic Engineering, Tsinghua University, Beijing, 100084, China.,

Abstract A simple and stable SIM card interface design


for general purpose is presented in this paper. This design

It connects to PC with a USB (Universal Serial Bus) and a friendly UI is provided.

is strictly according to specification [1][2] and solves the


main technical problem of power supply, initialization and data input/output of class A and class B SIM. With its friendly user interface, some convenient SIM service

II. Hardware Design


A SIM card accords with IS07816 specification[l] as an IC and GSMl1.11 specification[2] as a SIM. So
these two specifications are the main according of our design. The hardware includes three blocks: the power block, the clock block and main control block. The power block adopts the REG1117 chip of TI Inc.

is provided for extending its application to Personal


Computer and the Internet.

Keywords : SIM card; data input/output, CMOS switch,


User Interface

A standard 5V power is obtained from the USB interface,

I. Introduction
SIM card (Subscribe Identity Module card) is an important part in the digital mobile communication system. It records data and information with embedded Large Scale Integrated Circuits. Services are provided by the inputloutput of the data through Mobile Equipment. A SIM card readerlwriter is necessary for any application design based on SIM service. The SIM interface equipment is seldom found except Mobile Telephone, which makes the SIM application design difficult. There is trouble in some operation like setting up an address book with many entries in a SIM. It should be more convenient i f a more friendly UI (User Interface) is provided. The SIM readerlwriter design presented in this paper is simple and stable with a CY7C63221 of Cypress Semiconductor Corp. as the main controller chip and CMOS switches as controllers of periphery circuits.

which can directly act as the power supply for class A SIM. It also plays a role of the input of the power block. The block outputs a standard power of 3.3V. The power passes the CMOS switches and supplies for the clock and the SIM card. It depresses a Little to be about 3.0V and just meets the requirement of class B SIM. SIM clock is required to be L6MHz. An internal 6MHz clock output o f CY7C63221 is used to be the input of the clock block. In the block, it is turned down twice by a clock trigger chip 74HC109, outputting the ISMHz SIM clock. Such a clock frequency is also selected considering the communication rate of USB. Signal CLKin is the clock output of CY7C63221, whose amplitude is 5V. When SIM-VCC is 5V, the amplitude of CLKout is 5V. When SlM-VCC is 3.3V, the amplitude of CLKout is clamped to 3.3V. So the requirement that the high level of SIM clock not exceed SIM power supply is satisfied. The main control block is figured in Fig.]. The MC14066 chip of MOTOROLA Inc. that has four independent CMOS switches isapplied. The switches are controlled by four 10s of the main controller. Through the work of IO1 and 102, adaptive 5V/3.3V power is supplied to SIM. Meanwhile, the proper RST and CLK signals are provided. They have the same requirement on

+ Supported by National Natural Science Foundation of China


(699720201, in part by the National Fundamental Research

Program (G1998030406), and by State Key Lab on Microwave and Digital Communications, Department of Electronic
Engineering,

TSINGHUA University.

* Correspondingauthor, Email: wuo00~~aiIs.tsinehua.edu.cn

0-7803-7547-5/02/$17.00 02002 IEEE

1271

A DESIGN OF SIM CARD INTERFACE FOR GENERAL PURPOSE

I/O port that no high level can exceed power supply, so signal 104 and 105 must work together to control high or
low voltage level when inputting data to SIM. When the

regarded right if TS is decoded right. Decode of ATR can tell SIM parameters like the communication rate it supports. PPS (Protocol and Parameter Select) procedure can he taken to configure Enhanced Speed. Use PPS command FF-OC-FF or just skip PPS to configure all parameters as default value. The procedure of receiving one byte is as follows. First the I 0 5 port of the main controller is configured as a falling-edge-trigged intermpt input. Every byte has a synchronous bit ml=A and the state of IO port should be

SIM outputs data, we simply turn off SWITCH4 and read data in 105. It is a main character in hardware design of
the skillful and cooperative work of CMOS switches, which substitutes the traditional complex power conversion circuits composed of triodes and diodes. It makes the.hardware explicit and stable, simplifies the firmware in the main controller chip and appends little cost to the whole design.
33 N
v T

Clock Block ~

S card n

Z when no data is conveyed. Hence, the synchronous bit would trigger an intermpt. In the interrupt service
procedure, the interrupt input on I 0 5 is closed. In default, letu (element time unite, that is, time ofevery bit) equals 372/f Delay proper time and read IO at the mid of each bit. Repeat to receive a whole byte. Decodes the byte according to TS. If parity error occurs, set 10 low during

clx*.A
P o v r Block

un.m

0.5- I .S etu after the parity bit. Thus the SIM will send the
byte repeatedly. If the parity check successes, configure
l m

I
Fig.1 Main Block of the hardware

105 as the interrupt input for the next byte.

UI. Firmware Implement


The time requirement of

SIM signal

during

initialization is in Fig.2, where f is the SIM clock. The flow chart of SIM reset is in Fig.3. Suppose a SIM card is in class B and power it up at 3.3V, if success then continuing normal operation; otherwise suppose it in class A, power it up at 5V through approximate approach. The definition and format ofATR refers to 1907816-3. The SIM outputs ATR at default baud rate of f/372, where f is the SIM clock. The first byte of ATR is TS (Fig.4). State Z/A represents High/Low voltage level. m l is the synchronous bit. m 2 m 9 is the data bits and m10 is the parity bit. TS can be one of two possibilities: ZZAZZZAA or ZZAAAAAA. The former sets up the direct convention where state Z represents logical value 1 and m2 conveys the least significant bit (Isb first). The first byte TS is decoded as 38 in this case. The later sets up the inverse convention where state A represents logical value I and m2 conveys the most significant bit (msb first). The TS is decoded as 3F in this case. ATR is Fig.4 The first byte of ATR When we wite data to SIM, expecting the output on the SIM IO port to be low, the low voltage output on I 0 4 Fig.? Requirement on time of SIM signal during initialization ta s
i
Ta
i
I

mo 7

4c0 4
f

fb fb

o - s r e s 4m 4w f I

turns off SWITCH4. The output of I05 is also low. When


it is desired to output high voltage on the SIM 1 0 port,

1272

configure 105 as the input port So it will not influence the voltage on the port. The high voltage output on I 0 4 now turns on SWITCH4. We are supposed to know the architecture of data (Fig.5) in SIM when it is reading. MF is the Master File at the root position. DF1,DFZ ... the dedicated files as are subdirectory under which an: EFs (Element Files). Every file is identified with an ID. The file for address book ADN (Abbreviated Dialing Number) EF in the example given following is in the subdirectory of TELECOM DF. It is a data set of linear fixed structure that has a tile header and a number of records (Fig.6). Parameters like tile properties, tile length and record length are included in the file header. The records, which include formatted information like name and telephone number, are stored one by one and indexed for its record number. The commands for SIM are mapped to APDU (Application Protocol Data Units, Fig.7). The first byte CLA is the class of instruction. AV is used in the GSM application. The second byte INS is the instruction code for command. P I , P2 and P3 are parameters for command; Data is the body of data. The last two bytes SNI and SN2 in response APDU are the status words indicating the successful or unsuccessful outcome of the command.

ICLAIINS]Pl(P2(P3 I I.a) . ~
Data

Data

1 SN1 ISN2 1

(b)
Fig.7 (a) General Fonat for Command APDU (b) General Format for Response APDU An application example is given following to show a whole communication process for the SIM, in which one record in the address book is read out, edited and written back. Data stream is in Table.1, all data is hexadecimal. First, send SELECT FlLE command to select MF, TELECOM DF and ADN EF sequentially. Le is the length of ADN EF file header. Send GET RESPONSE command, SIM returns ADN EF file header, in the 15th byte of which record length RI is indicated. Send READ RECORD command, and SIM returns a complete record. An example record is given in Table.2. 1- 14 bytes are for the name coded in ASCII, ABC in the example, with unused bytes stuffed with ff. The 15th byte is the length of the telephone number, which is from the 16th byte to the end of the record. The first byte of the telephone number 81 means it is coded in extended BCD format, 1234567890 in the example. Modify the record, for example, change name to CBA and number to 0987654321 in Table.2 (b), and send UPDATA RECORD command to write the modified record back to SIM.

,
EP2
EP3
E7 l4

Table.1 Whole Communication Prmess of Read and Write a Record in SIM Address Book +SIM:
EP5

A0 A4 00 OO//SELECT FILE COMMAND 023F00 A0 A4 00 00 027F 10 / M F ID //SELECT FILE IITELECOM DF ID //SELECT FILE

CSIM A4 00
+SIM: +SIM:

CSM 9FLe
Fig.5 File Structure of S N

Header

C-SIM A4 00

Record 1 Record 2

+SIM:

C-SIM: 9 F L e 3 SIM: A0 A4 00 00

C-SIM: A 4 0 0
3SIM:
Fig.6 Data Structure for ADN File 3SIM:
02 6F 3A NADN EF ID

t S M 9FLe
A0 CO 00 00 Le CSIM: Data 90 00 //GET RESPONSE

1273

+SIM: A0 8 2 01 04 R I //READ RECORD H I M : Data 90 00 J S I M : A0 DC 01 0 4 IRmDATE RECORD

presented in this paper. Involved technique details are specified. This design makes the operations like setting up and sharing of an address book of SIM very convenient. The communication of SIM with PC through USB extends the application of SIM services to PC and thereby the Internet. The design could perform as a hardware platform for the SIM service application development for general purpose, as well as a reference for IC readedwriter hardware design.

CSM DC00 +SIM: Data /hew record H I M : 9000 Table.2 (a)One Record (b)The Record Modified Data: 41 42 43 ff ffff ff ff ff ff ff ff ff ff 06 81 21 43 65 87 09 ff ff ff ff ff ff ff
(a) 43 42 41 ff ffff ff ff ff ff ff ff ff ff 06 81 90 78 Data: 5634 12ffffffffffffff The UI (b) is an ordinary Personal Computer.

References
[I] International Organization For Standardization, International Standard ISO/IEC 7816, First edition, 1998-10-15, http://www.iso.ch.
[2] European Telecommunications Standards Institute,

Communication between SIM and PC is easily fulfilled through USB, for the excellent support for USB communication on CYlC6322 I chip. Plenty of functions are provided in the main controller chip for all kinds of read/write commands for the client program of U1 to call, which performs as a hardware platform for general purpose. The quality is satisfying from the test for SIM cards of China Mobile Inc., China Unicorn Inc. and some other companies in Hong Kong.

3GPP TS 11.1 I, htto://www.etsi.org.

version

8.5.0,

Release

1999,

[3] L. Zongxiang, Subscribe Identity Module For GSM System, Mobile Communication, China, pp. 4246, Jun.
1996. [4] L. Hongyi, Ch. Mading, Interface Design Between IC And Singlechip, Electronic Technology Application,

China, pp, 18-19, Oct. 1998. [5] Zh. Xing, ValueAdded Service For Short Message, Telecom Science, China, pp. 71-72, Jan. 2001.

V. Conclusion
A SIM card interface design with good performance is
FirmwvareLoadcdSIM i n ~ i o a d i &te ~e

3
I

Power SIM up

at

3.3V

Dslaytime tb,RtretSIM

,-

llutializc SYCCCIS.

C0ntbC

normal operation

Idialbe fail de-active SIM

Fig.3 Flow chart of SIM reset, ( I ) ATR, Answer To Reset

1274

Anda mungkin juga menyukai