NXP Reader Library  v17.1.0.2535

SAM commands used for ISO14443 layer 3 communication in X-Mode. More...

Collaboration diagram for 15_ISO14443_3:

Modules

 Defines
 Definitions for ISO14443 layer 3 commands.
 

Functions

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_RequestA_Wakeup (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bCmdCode, uint8_t *pAtqa)
 Perform a request or wake-up command (type A). More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_AnticollisionSelect (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pSelCodes, uint8_t bSelCodesLen, uint8_t *pSak, uint8_t *pUid, uint8_t *pUidLen)
 Perform bit-wise anticollision and select. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_ActivateIdle (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bOption, uint8_t bNumCards, uint16_t wTime, uint8_t *pAtqaIn, uint8_t *pSakIn, uint8_t **ppResponse, uint16_t *pRespLen)
 Perform one or several request - anticollision - select sequences and returns the SAK and the UID of the selected PICC(s). More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_ActivateWakeUp (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pUid, uint8_t bUidLen)
 Perform reactivates and selects a PICC that has previously been set to Halt state. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_HaltA (phhalHw_Sam_DataParams_t *pDataParams)
 Puts a selected card into Halt state. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_TransparentExchange (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pTxBuf, uint8_t bTxLen, uint8_t bTxBitLen, uint8_t **ppRxBuf, uint16_t *pRxLen, uint8_t *pRxBitLen)
 Perform exchange bytes/bits transparently with a PICC. More...
 

Detailed Description

SAM commands used for ISO14443 layer 3 communication in X-Mode.

Function Documentation

◆ phhalHw_Sam_Cmd_X_ISO14443_3_RequestA_Wakeup()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_RequestA_Wakeup ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bCmdCode,
uint8_t pAtqa 
)

Perform a request or wake-up command (type A).

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpAtqa is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCmdCode[In] Command code.
[out]pAtqa[Out] AtqA returned by the card. The buffer has to be 2 bytes long.

◆ phhalHw_Sam_Cmd_X_ISO14443_3_AnticollisionSelect()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_AnticollisionSelect ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pSelCodes,
uint8_t  bSelCodesLen,
uint8_t pSak,
uint8_t pUid,
uint8_t pUidLen 
)

Perform bit-wise anticollision and select.

The anticollision and the following select are performed according to the select code in the data field.

  • The selection can be carried out for a variable amount of cascade levels. The select codes have to be listed in the data field subsequently. The MIFARE SAM AV4 will take the parameters exactly and use them as select code. Therefore to fully select a card with a triple UID, the data field has to be of three bytes length indicating 93h, 95h and 97h whereas the data field has to be of one byte length indicating 93h if a single size UID card are selected.
  • If the select code indicates a cascade level of 93h and 95h, and the UID of the card consists only of four bytes, the MIFARE SAM AV4 will exit the command and return the SAK and the UID of the card.
  • If the select code indicates a cascade level of 93h, and the UID consists of more than four bytes the MIFARE SAM will also exit the command and return the SAK and the first three bytes of the UID but indicates with a special return code the incompleteness of the UID separately. The caller has then to take care about continuing the procedure on his own by calling the command once more with a higher select code. The already returned UID bytes will not be returned a second time. The same applies for a select code of 95h if the UID is of ten bytes length (suggest that a selection with code 93h is carried out previously).
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpSelCodes, pSak, pUid and pUidLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pSelCodes[In] Buffer containing the SEL sequence bytes.
[in]bSelCodesLen[In] Length of bytes available in pSelCodes buffer. (01h to 03h).
[out]pSak[Out] Buffer to the 1 byte Select Acknowledge reveived from card.
[out]pUid[Out] Buffer containing the received UID. This buffer has to be 10 bytes long.
[out]pUidLen[Out] Length of bytes available in pUid buffer.

◆ phhalHw_Sam_Cmd_X_ISO14443_3_ActivateIdle()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_ActivateIdle ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bOption,
uint8_t  bNumCards,
uint16_t  wTime,
uint8_t pAtqaIn,
uint8_t pSakIn,
uint8_t **  ppResponse,
uint16_t pRespLen 
)

Perform one or several request - anticollision - select sequences and returns the SAK and the UID of the selected PICC(s).

  • The ATQA is returned for every request issued, this means for every newly activated card. Due to the fact that the resulting ATQA is the OR-function of all ATQAs, the value may change frequently.
  • The command offers several different possibilities for activating cards:
    • Wait for a definable number of cards and return if this number of cards has been activated
    • Either try only one activation sequence and return if no PICC is detected, wait for a defined amount of time, or wait until the expected number of PICCs was activated
    • Apply a filter for the ATQA response of the PICC(s)
    • Apply a filter for the SAK response of the PICC(s)
  • If more than one PICC are activated, the MIFARE SAM puts all activated PICC(s) into the Halt state.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpAtqaIn, pSakIn and pRespLen are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bOption[In] Option to be used for P2 and internal to library. Can be combined by using bitwise OR operator.
[in]bNumCards[In] Holds the number of cards to activate.
[in]wTime[In] Time to wait for a card.
[in]pAtqaIn[In] Buffer containing the AtqA filter. Should contain the following, Mask (1 byte) || Value (1 byte) || Mask2 (1 byte) || Value2 (1 byte)
[in]pSakIn[In] Buffer containing the Sak filter. Should contain the following, Mask (1 byte) || Value (1 byte)
[out]ppResponse[Out] Buffer containing the received data.
  • ATQA (Answer To re-Quest type A): 2 bytes
  • SAK (Select AcKnowledge) : 1 byte
  • Len (Length of card UID) : 4, 7, 10 bytes
  • UID (Unique Identified) : Card UID
[out]pRespLen[Out] Length of bytes available in ppResponse buffer.

◆ phhalHw_Sam_Cmd_X_ISO14443_3_ActivateWakeUp()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_ActivateWakeUp ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pUid,
uint8_t  bUidLen 
)

Perform reactivates and selects a PICC that has previously been set to Halt state.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpUid is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pUid[In] UID of the card to reactivate.
[in]bUidLen[In] Length of bytes available in pUid buffer (4, 7 or 10 bytes).

◆ phhalHw_Sam_Cmd_X_ISO14443_3_HaltA()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_HaltA ( phhalHw_Sam_DataParams_t pDataParams)

Puts a selected card into Halt state.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.

◆ phhalHw_Sam_Cmd_X_ISO14443_3_TransparentExchange()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_3_TransparentExchange ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pTxBuf,
uint8_t  bTxLen,
uint8_t  bTxBitLen,
uint8_t **  ppRxBuf,
uint16_t pRxLen,
uint8_t pRxBitLen 
)

Perform exchange bytes/bits transparently with a PICC.

The MIFARE SAM will take the user data and send it without changing, inserting or appending any content to the contactless card. Appending of a CRC, time-out settings, etc. have to be configured by directly writing the RC52x/RC663 registers. Take into account that switching settings of the Reader IC influence all subsequent MIFARE SAM commands proposing the correct Reader IC settings, that is ISO14443- 4_Exchange.

  • If bits are exchanged, parameter P1 indicates the number of bits valid in the last input byte. A value of 00h indicates that the full last byte are sent to the PICC. Consequently, for using the function as pure byte exchange, P1 has to be set to zero. In case that only a few bits of the last byte are sent, the MIFARE SAM will take the indicated number of bits beginning with the LSBit of the last input byte.
  • Take into account that this function cannot be used for bit wise anticollision since the MIFARE SAM will react on a detected collision with an error and not return any bytes (bits).
  • If the card responds with single bits, the MIFARE SAM will indicate the number of valid bits within the last returned byte in the lower nibble of SW2. SW2 = 00h indicates that the full byte was received from the PICC. The last returned data byte contains the valid bits according to the indicated amount starting with the LSBit.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpTxBuf, pRxLen and pRxBitLen are NULL.
PH_ERR_SUCCESS_INCOMPLETE_BYTENumber of bits valid in the last returned data byte in lower nibble of SAM status SW2.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pTxBuf[In] Buffer containing the data to be sent. The buffer has to be bTxLen bytes long.
[in]bTxLen[In] Length of bytes available in pTxBuf buffer.
[in]bTxBitLen[In] Number valid bits (0x00 - 0x07) in the last byte of the pTxBuf buffer. If set to 00h all bits are valid.
[out]ppRxBuf[Out] Buffer containing the received data from PICC.
[out]pRxLen[Out] Length of bytes available in ppRxBuf buffer.
[out]pRxBitLen[Out] Amount of valid bits in the last byte in case of an incomplete byte.