User manual
NXP Semiconductors
UM10663
NXP Reader Library User Manual
UM10663
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2013. All rights reserved.
User Manual
COMPANY PUBLIC
Rev. 1.2 — 24 July 2013
257412
40 of 47
Initialize the KeyStore component. We will need it to store key into EEPROM key storage
area.
193
PH_CHECK_SUCCESS_FCT(status, phKeyStore_Rc663_Init(&Rc663keyStore,
194
sizeof(phKeyStore_Rc663_DataParams_t), pHal));
Initialize the MIFARE Classic AL component (see section 2.4.1) - set NULL because the
keys are loaded in EEPROM by the function
phKeyStore_SetKey()
(line 260).
199
PH_CHECK_SUCCESS_FCT(status, phalMfc_Sw_Init(&alMfc,
200
sizeof(phalMfc_Sw_DataParams_t), &palMifare, NULL));
The SoftReset (see section 2.1.15) only resets the CLRC663 to EEPROM configuration.
207
PH_CHECK_SUCCESS_FCT(status, phhalHw_Rc663_Cmd_SoftReset(pHal));
Just for sure, reset CLRC663 field.
218
PH_CHECK_SUCCESS_FCT(status, phhalHw_FieldReset(pHal));
Before any communication attempt with MIFARE Classic, set up reader chip to
ISO/IEC14443p3A communication protocol, which is MIFARE Classic compliant protocol
(see section 2.1.13). Even we don’t know if in the PCD’s field any card at all.
222
PH_CHECK_SUCCESS_FCT(status, phhalHw_ApplyProtocolSettings(pHal,
223
PHHAL_HW_CARDTYPE_ISO14443A));
From this time on, reader chip is prepared to communicate with ISO/IEC14443p3A
compliant cards.
It might seem like program ignores the RequestA operation (if there is any card in the
range of field) and skips directly to Activation phase, that would be violating of
ISO14443p3A. But
phpalI14443p3a_ActivateCard()
includes RequestA also. Section 2.3.4
provides quite precious description of this function.
227
status = phpalI14443p3a_ActivateCard(&I14443p3a, NULL, 0x00, bUid,
&bLength, bSak, &bMoreCardsAvailable);
If the is a card in the field and the activation is successful, since last four passed
parameters are pointers. Anti-collision procedure is also included here, so even if there
are more cards in the PCD’s field, only one card is selected – one UID captured.
If there is a card in the field of PCD reader, previous Activate function runs successfully
and obtains SAK byte from the card also. That is byte code saying about the type of the
card.
232
if (PH_ERR_SUCCESS == status)
233
{
237
if (0x20 == (*bSak & 0x20))
238
{
239
debug_printf_msg("ISO-4 compliant card detected");
240
}