Article from the series "ATR statistics
TD1 - Structural, encodes Y2 and T
The ISO 7816-3 specification is not public. So I can't copy/paste part of the text. I will use Wikipedia instead.
From Wikipedia https://en.wikipedia.org/wiki/Answer_to_reset#Interface_bytes_TDi
Interfaces bytes TDi for i≥1, if present, are structural.
TDi encodes in its 4 high-order bits the presence of at most 4 other interface bytes: TAi+1 (resp. TBi+1, TCi+1, TDi+1) follow, in that order, if the 5th (resp. 6th, 7th, 8th) bit of TDi is 1.
TDi encodes in its 4 low-order bits (4th MSbit to 1st LSbit) an integer T, in range [0..15]. T = 15 is invalid in TD1, and in other TDi qualifies the following TAi+1 TBi+1, TCi+1, TDi+1 (if present) as global interface bytes. Other values of T indicates a protocol that the card is willing to use, and that TAi+1 TBi+1, TCi+1, TDi+1 (if present) are specific interface bytes applying only to that protocol. T = 0 is a character-oriented protocol. T = 1 is a block-oriented protocol. T in the range [3..14] is RFU.
Historical note: provision for dynamically qualifying interface bytes as global using T = 15 did not exist in ISO/IEC 7816-3:1989.
TD1 (as the other TDi bytes) is structural and indicates:
- How to interpret the other ATR bytes
- What communication protocol the card wants to use
For 43% of the ATRs no TD1
is present. So no other TA2
is present and no protocol is defined so the default T=0 will be used.
For 22% of ATRs TD1
= 0x80 so bit 8 is set to indicate that a TD2
is present and T=0 is used. One such ATR is 3B 80 80 01 01
For 17% of ATRs TD1
= 0x81 so, as in the previous case, TD2
is present but T=1 is used. One such ATR is 3B 82 81 31 76 43 C0 02 C5
For 5% of ATRs TD1
= 0x40 so TC2
is present and T=0 is used. One such ATR is 3B 85 40 20 68 01 01 00 00
I will not document all the other cases. I let this exercise to the reader.
One special case is TD1
= 0x?E to indicate the T=14 protocol.
From ISO 7816-3:
The type T refers to a transmission protocol and/or qualifies interface bytes.
- T=0 refers to the half-duplex transmission of characters specified in clause 10.
- T=1 refers to the half-duplex transmission of blocks specified in clause 11.
- T=2 and T=3 are reserved for future full-duplex operations.
- T=4 is reserved for an enhanced half-duplex transmission of characters.
- T=5 to T=13 are reserved for future use by ISO/IEC JTC 1/SC 17.
- T=14 refers to transmission protocols not standardized by ISO/IEC JTC 1/SC 17.
- T=15 does not refer to a transmission protocol, but only qualifies global interface bytes.
As you can see in the list above "T=14 refers to transmission protocols not standardized by ISO/IEC JTC 1/SC 17." In my list T=14 is used only by pay TV cards like 3B 9F 21 0E 49 52 44 45 54 4F 20 41 43 53 03 83 95 00 80 55
= 0x?F is also another special case to indicate T=15, which is not a protocol, and will change the interpretation of the following ATR bytes.