I4CE.StartEmu

This command is deprecated. Do not use it in new code as we may remove it in the future!

This command is marked as deprecated as it is not supported by Baltech's SDK. There is currently no alternative for this command.

This command starts the reader's passive mode, emulating an ISO14443-4 compatible card, and returns the first APDU request received.

The emulated PICC answers all ISO14443-3 request, anticollision and select commands. It utilizes the 4-Byte serial number specified in the Snr parameter. The Byte order corresponds to ISO14443-3: The first Byte (uid0) will be transmitted first to the reader. It has to be 0x08 as this indicates a random serial number.

To identify potential errors, the PCD starts a timer within which the PICC has to respond, after sending out each frame. This time duration is the so-called frame waiting time (FWT). FWT is determined by the PICC during protocol activation and is valid for all further communication. This parameter should be chosen as large as required, but as small as possible. The communication speed between card emulator and host and the processing speed of the host should be taken into consideration. It is possible to increase the FWT temporarily for a single frame by calling the I4CE.ExtendWaitingTime command. Since the ISO14443 protocol specification only allows discrete FWT values, the firmware calculates the lowest value that meets the specified waiting time according to the equation

FWI = (256 * 16 / fc) * 2 ^ FWT,

where fc is the RFID carrier frequency. The highest possible FWT value is 4949 ms.

Two timeout parameters triggering two timers have to be specified for this command. The first timer, associated to the TimeoutPCD parameter, stops as soon as the first PCD command frame after the card selection as defined in ISO14443-3 is received. If the emulated PICC does not receive anything within TimeoutPCD, this command will return an I4CE.ErrIso144State status code, which indicates that the PICC did not receive the required protocol activation sequence to exchange ISO14443-4 APDUs. If a PCD frame is received before TimeoutPCD elapses, the second timer, associated to the TimeoutAPDU variable, is started. If this timer elapses before the reader receives the first protocol activation sequence and the first APDU, the I4CE.ErrTimeout status code is returned. Otherwise, the first APDU request is returned in the command's response.

The ATS (historical bytes) the card emulation shall use may be specified by the ATS parameter if required. This parameter may also be left out, in which case no historical bytes are sent.

As already mentioned, ISO14443-4 specifies that a card has to send a response within FWT ms. The command I4CE.ExtendWaitingTime can be called to extend this time temporarily if the host cannot prepare the APDU within the defined FWT time. A more convenient way to perform this action is to use the automatic WTX mode: If the parameter AutoWTX is set to 1, the card emulation will automatically transmit WTX requests periodically every 0.9 * FWT ms after the successful execution of the I4CE.StartEmu command and of all subsequent I4CE.ExchangeInverseAPDU commands. In practice, this allows to ignore the FWT limits, since the card emulation itself keeps the communication with the PCD alive.

Properties

Parameters (request frame)

Name Type/Size Description
Snr Raw data (length 4 Bytes)

Card serial number of the emulated PICC according to the ISO14443-3 specification (uid0, uid1, uid2, uid3).

FWT Integer (16 bits)

Frame waiting time in ms. This is the maximum time the PCD waits for the next PICC response.

If FWT is set to 0 the default frame waiting time of 77.328 ms will be applied.

TimeoutPCD Integer (16 bits)

Maximum time (in ms) to wait for the first frame sent from the PCD.

A value of 0xFFFF corresponds to an infinite time.

TimeoutAPDU Integer (16 bits)

Maximum time (in ms) to wait for the first ISO14443-4 APDU after the first received PCD frame.

A value of 0xFFFF corresponds to an infinite timeout.

Length of ATS Integer (8 bits) Length of ATS in bytes
ATS Raw data ATS (Historical Bytes) to use for card emulation.
AutoWTX Integer (8 bits) Enable/disable automatic Waiting Time Extension (WTX).

Returned values (response frame)

Name Type/Size Description
Length of FirstCmd Integer (16 bits) Length of FirstCmd in bytes
FirstCmd Raw data First ISO14443-4 APDU request received from the PCD.