in Work&Life

ISO7816-3 / ATR / Baud Rate / PPS

ISO7816-3 describes smart card electric signals and transmission protocols, the detail can refer to the spec, below are some examples about for better understanding about the spec,

1, ATR and Baud Rate

my Singapore cash card ATR “3B2A00806524B0000200829000”

3B = TS – (H) LHHL HHH LLH sets up the direct convention

2A = T0, includes Y1 = bit8 to bit5 value as 2, bit wise as 0010, means only TB1 exists, and K as bit4 to bit1 value as 0x0A, history bytes length 0x0A.

00 = TB1, EMV still requires that the card includes TB1 = ‘00’, and that remains common practice.

History bytes = 806524B0000200829000, length as 10 bytes(0x0A).

My Citi bank credit card ATR “3B6E000080318066B0840C016E0183009000”

3B = TS – (H) LHHL HHH LLH sets up the direct convention

6E = T0, includes Y1 = bit8 to bit5 value as 6, bit wise as 0110, means only TB1 and TC1 exist, and K as bit4 to bit1 value as 0x0E history bytes length 0x0E .

00 = TB1, EMV still requires that the card includes TB1 = ‘00’, and that remains common practice.

00 = TC1, encodes the extra guard time integer (N) from 0 to 255 over the eight bits. The default value is N = 0

History bytes = 80318066B0840C016E0183009000, length as 14 bytes(0x0E).

(U)SIM card ATR example: “3B9796801F438031E073FE211B3B”

3B = TS – (H) LHHL HHH LLH sets up the direct convention

97 = T0, includes Y1 = bit8 to bit5 value as 9, bit wise as 1001, means only TA1 and TD1 exists, and K as bit4 to bit1 value as 0x07, history bytes length 0x07.

96 = TA1, encodes the maximum clock frequency f(max) supported by the card. Now the value as 0x96, bitwise as 10010110, ETU(Elementary time unit)= (F/D)*(1/f). For 0x96, Fi = 512, D = 32, the etu = (512/32)*(1/3.575945* 10exp6) = 4.48 us, the Baud Rate  = 1/4.48 us = 223K bps, if f = 5MHZ, then using the same formula, the Baud Rate  = 312K bps

When TA1 is absent, it’s assumed default value is ‘11’, corresponding to fmax = 5 MHz, Fi = 372, Di = 1.

Different TA(1) has different baud rate selection, below are some frequently used baud rate,

11 = 9600
13 = 38400
14 = 76800
94 = 56000

95 = 112000

96 = 223000

97 = 446000

80 = TD1, bitwise as 10000000, bits 8 to 5 state whether TA2, for bit 5, TB2, for bit 6, TC2 for bit 7, TD2 for bit 8 are present or absent, here means TD2 exists. bit4 to bit1 are for the T, T = 0 is the protocol T = 0

1F = TD2, here means TA3 exists. T = 15, does not refer to transmission protocol.

43 = TA3, bit8~bit7 as 01, State L, bit6~bit1, as 000011, means class A and B.

History bytes = 8031E073FE211B, length as 07 bytes(0x07).

3B = TCK,  If T=0 and T=15 are present and in all the other cases, TCK shall be present, exclusive-oring all the bytes T0 to TCK inclusive shall give ’00’

T = 1 ATR example: “3BD49600C01071FE4501112233441D”

3B = TS – (H) LHHL HHH LLH sets up the direct convention

D4 = T0, includes Y1 = bit8 to bit5 value as D, bit wise as 1101, means only TA1, TC1 and TD1 exists, and K as bit4 to bit1 value as 0x07, history bytes length 0x07.

96 = TA1, calculation is the same as above 0x96

00 = TC1, encodes the extra guard time, the same as above.

C0 = TD1, bitwise as 11000000, bits 8 to 5 state whether TA2, for bit 5, TB2, for bit 6, TC2 for bit 7, TD2 for bit 8 are present or absent, here means TC2 and TD2 exist. bit4 to bit1 are for the T, T = 0 is the protocol T = 0

10 = TC2, WI(Waiting Time Integer), to calculate the WT (Waiting Time) = WI * 960 * Fi / f, can get it from Chapter 10.2 in ISO7816-3

71 = TD2, bitwise, 01110001, means TA3, TB3 and TC3 exist, bit4~bit1 means T = 1

FE = TA3, the initial value of IFSC (maximum information field size for the card)

45 = TB3, CWI (character waiting time integer), CWT(character waiting time), CWT is
calculated from CWI by the following formula.

01 = TC3, CRC or LRC,

History bytes = 11223344

1D = TCK,  If T=0 and T=15 are present and in all the other cases, TCK shall be present, exclusive-oring all the bytes T0 to TCK inclusive shall give ’00’

2, PPS (Protocol and Parameters Selection)

the smart card and device to negotiate the communication baud rate by request and response.

The format is PPSS + PPS0 + (PPS1 + PPS2 + PPS3) + PCK

PPSS is FF,

PPS0, each bit 5,6 or 7 set to 1 indicates the presence of an optional byte PPS1, PPS2 and PPS3, bit4 ~ bit1 indicates proposed transmission protocol.

Example one, FF10957A, PPS0 as 10, means PPS1 exist and T = 0, the baud rate proposed as 95, PCK = 7A

Example two, FF109679, PPS0 as 10, means PPS1 exist and T = 0, the baud rate proposed as 96, PCK = 79

Example three, FF1111FF, PPS0 as 11, means PPS1 exist and T = 1, the baud rate proposed as 11, PCK = FF.

3, Reference:

ISO/IEC 7816-3:2006 — Identification cards — Integrated circuit cards — Part 3: Cards with contacts — Electrical interface and transmission protocols (partial preview)

http://blog.csdn.net/eastmoon502136/article/details/8115298

http://www.smartcard.co.uk/tutorials/sct-itsc.pdf

http://www.sat.su/satxpress/SmartCard/quartz.htm

http://smartcardguide.blogspot.sg/2013/05/protocol-t0t1.html

http://www.pcscworkgroup.com/membership/members.php

 

I will try to get some example to write on the T = 1 protocol in detail in near future.

 

Leave a Reply for Jayakrishna Cancel Reply

Write a Comment

Comment