Identification cards — Integrated circuit cards —Part 3: Cards with contacts — Electrical interface and transmission protocols
Cartes d’identification — Cartes à circuit intégré à contacts —Partie 3: Cartes à contacts — Interface électrique et protocoles de transmission

Chaining
The chaining function allows the interface device or the card to transmit information (application data) longer than IFSC or IFSD. If the interface device or  the card has to transmit information longer than IFSC or IFSD respectively, it should divide the information into pieces, each with length less than or equal  to IFSC or IFSD, and it should transmit each piece in a block using the chaining function. Figure 23 illustrates the chaining function.

ISO SLE5528 Cards,SLE5528 Cards,SLE5528,Infineon SLE5528,SLE5542,SLE5542 Contact Smart Cards,SLE4442 Contact Smart Cards,Memory Overview SLE 4442,

Figure 23 — Chaining function
The M-bit in PCB controls the chaining of I-blocks. The value of the M-bit indicates the state of the I-block.
–If M = 1, then the I-block is chained to the next block, which shall be an I-block.
–If M = 0, then the I-block is not chained to the next block.
If the receiver correctly receives a more-data I-block, then it shall transmit R(N(R)), where N(R) is set to N(S) of the expected I-block.
NOTE I-blocks with LEN = ’00′ may be used within a chain (see scenario 7 in annex A).

Protocol rules for error-free operation
Rule 1 — The interface device transmits the first block, either an I-block with N(S) = 0 denoted I(0, M), or an S-block.
Rule 2.1 — I(Na(S), 0) transmitted by A is acknowledged by I(Nb(S), M) transmitted by B to transfer application data and to indicate readiness to receive

the next I-block from A.
Rule 2.2 — I(Na(S), 1) transmitted by A is acknowledged by R(Nb(R)) transmitted by B [Nb(R) is not set to Na(S)] to indicate that the received block was

correct and the readiness to receive the next I-block from A.
NOTE Chaining is only possible in one direction at a time.
Rule 3 — If the card requires more than BWT to process the previously received I-block, it transmits S(WTX request) where INF conveys one byte encoding an

integer multiplier of the BWT value. The interface device shall acknowledge by S(WTX response) with the same INF.
The time allocated starts at the leading edge of the last character of S(WTX response).
Rule 4 — The card transmits S(IFS request) to indicate a new IFSC it can support. The interface device shall acknowledge by S(IFS response) with the same

INF. The interface device assumes the new IFSC is valid as long as no other IFSC is indicated by another S(IFS request).
The interface device transmits S(IFS request) to indicate a new IFSD it can support. The card shall acknowledge by S(IFS response) with the same INF. The

card assumes the new IFSD is valid as long as no other IFSD is indicated by another S(IFS request).
For the encoding of IFSC and IFSD in INF, see 11.4.2.
Rule 5 — Chaining is indicated by the M-bit, where I(N(S), 0) is a non-chained block or the last block of a chain. I(N(S), 1) is a part of a chain and shall

be followed by at least one chained block.
R(N(R)) requests transmission of the next chained I-block I(N(S) = N(R), …) and acknowledges the received chained I-block I(NOT N(R), 1).

Error-handling
Errors detected by the receiver
The tasks of the block layer are to transmit blocks, to detect transmission and sequence errors, to handle such errors and to resynchronize the transmission

protocol. Therefore the block component of the data link layer should be able to handle the following errors.
–BWT time-out — The card did not transmit any character within the specified delay.
–Reception of an invalid block — Examples are
-character parity error(s),
-redundancy code error,
-invalid PCB (due to unknown encoding),
-invalid LEN (transmission error or incompatibility with the block type or with IFSC or IFSD),
-loss of synchronization because the block size and the number encoded by LEN are inconsistent,
-failure to receive the relevant S(… response) after having transmitted S(… request).
Resynchronization of the transmission protocol may be attempted at three consecutive levels. If one level is unsuccessful, then the next level is tried.
–For the interface device, the three levels are
-retransmission of blocks,
-use of S(RESYNCH request),
-warm reset or deactivation.
–For the card, the three levels are
-retransmission of blocks,
-use of S(RESYNCH response),
-without action by the interface device, the card becomes unresponsive.

Protocol rules for error-handling
Rule 6 — S(RESYNCH request) may be transmitted only by the interface device to reach resynchronization and to initiate resetting the communication

parameters of the transmission protocol to its initial values.
Rule 6.1 — If the receiver detects a loss of synchronization, it gets back the right to transmit after a silence on the electrical circuit I/O greater than

the larger of CWT or BGT.
Rule 6.2 — S(RESYNCH request) shall be responded to by S(RESYNCH response) from the card.
Rule 6.3 — After the interface device has received S(RESYNCH response), the transmission protocol is initiated.
Rule 6.4 — After the interface device has failed a maximum of three times in succession to reach the intended resynchronization by transmitting S(RESYNCH

request), it performs either a warm reset or a deactivation.
Rule 6.5 — When S(RESYNCH request) is received, the previously transmitted block is assumed not to have been received.
Rule 7.1 — When an I-block was transmitted and an invalid block is received or a BWT time-out (with the interface device) occurs, an R-block is transmitted,

which requests with its N(R) for the expected I-block with N(S) = N(R).
Rule 7.2 — When an R-block was transmitted and an invalid block is received or a BWT time-out (with the interface device) occurs, this R-block is

retransmitted.
Rule 7.3 — When S(… request) was transmitted and the received response is not S(… response) or a BWT time-out occurs (only with the interface device), S(

… request) is retransmitted.
When S(… response) was transmitted and an invalid block is received or a BWT time-out occurs (only with the interface device), an R-block is transmitted.
Rule 7.4.1 — After failing to receive an error-free block at the start of the transmission protocol, the interface device makes a maximum of two further

attempts in succession before performing either a warm reset or a deactivation.
Rule 7.4.2 — During the transmission protocol, if the interface device fails to receive an error-free block, it makes a maximum of two further attempts in

succession before transmitting S(RESYNCH request).
Rule 7.4.3 — If the card fails to receive an error-free block after a second attempt in succession, it remains in reception mode.
Rule 7.5 — During the transmission protocol, the card reacts on receiving an invalid first block by transmitting R(0).
Rule 7.6 — If the first block transmitted by the interface device is not responded to within BWT, the interface device transmits R(0).
Rule 8 — When the card transmits S(IFS request) and receives an invalid block, it retransmits a maximum of one more S(IFS request) in order to elicit an S

(IFS response). After the second failure, it remains in reception mode.
Rule 9 — The abortion of a chain can be initiated by either the transmitter or receiver of a chain transmitting S(ABORT request) which shall be answered by

S(ABORT response), after what an R-block may be transmitted depending on whether it is necessary to give back the right to transmit.
NOTE Abortion of chaining may be due to physical errors in the card, such as memory error.

Transmission of command-response pairs
Application protocol data units
Command-response pairs
An application protocol data unit is either a command APDU or a response APDU. A step in application protocol consists of transmitting a command APDU,

processing it in the receiving entity and returning the response APDU. This pair of APDUs is called a command-response pair.
Illustrated by Figure 24, each command APDU defined in this document consists of
–a mandatory header of four bytes denoted CLA INS P1 P2,
–a conditional body of variable length.
SLE5542,SLE5542 Contact Smart Cards,SLE4442 Contact Smart Cards,Memory Overview SLE 4441,

Figure 24 — Command APDU structure
Illustrated by Figure 25, each response APDU defined in this document consists of
–a conditional body of variable length,
–a mandatory trailer of two bytes denoted SW1 SW2 and encoding the status of the receiving entity after processing the command.

ISO SLE5528 Cards,SLE5528 Cards,SLE5528,Infineon SLE5528,

Figure 25 — Response APDU structure
The values of the command header and the response trailer shall be as specified in ISO/IEC 7816-4. If the process is aborted, then the card may become unresponsive. However if a response APDU occurs, then the response body shall be absent and SW1 SW2 shall indicate an error.

Data fields within command-response pairs
Each command-response pair may carry a command data field and/or a response data field.
–Nc denotes the number of bytes in the command data field. If Nc ≠ 0, then the Lc field is present for encoding Nc and the command data field consists of

the subsequent Nc bytes. If Nc = 0, then both the Lc field and the command data field are absent.
–Ne denotes the maximum number of bytes expected in the response data field. If Ne ≠ 0, then the Le field is present for encoding Ne. If Ne = 0, then the

Le field is absent.
–Nr denotes the number of bytes in the response data field. Nr shall be from zero to Ne. If Nr = 0, then the response data field is absent.
In case 1, Nc = Nr = 0. The command APDU consists of the header; the Lc field, the command data field and the Le field are absent. The response APDU consists of the trailer; the response data field is absent.
In case 2, Nc = 0 and Nr ≠ 0. The command APDU consists of the header and the Le field; the Lc field and the command data field are absent. The response APDU consists of the response data field and the trailer.
In case 3, Nc ≠ 0 and Nr = 0. The command APDU consists of the header, the Lc field and the command data field; the Le field is absent. The response APDU consists of the trailer; the response data field is absent.
In case 4, Nc ≠ 0 and Nr ≠ 0. The command APDU consists of the header, the Lc field, the command data field and the Le field. The response APDU consists of the response data field and the trailer.
Table 12 summarizes the four possible cases of command-response pairs.
Table 12 — Data fields within command-response pairs

SLE5542,SLE5542 Contact Smart Cards,SLE4442 Contact Smart Cards,Memory Overview SLE 4441,