NXP Reader Library  v17.1.0.2535

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

Collaboration diagram for 16_ISO14443_4:

Modules

 Defines
 Definitions for ISO14443 layer 4 commands.
 

Functions

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_RATS_PPS (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bCidIn, uint8_t bDsiIn, uint8_t bDriIn, uint8_t *pCidOut, uint8_t *pDsiOut, uint8_t *pDriOut, uint8_t *pAts)
 Perform a combined RATS and PPS sequence to prepare a PICC for T = CL data exchange. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_Init (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bCid, uint8_t bDri, uint8_t bDsi, uint8_t bFwi, uint8_t bFsci)
 Perform a init of ISO-14443-4 layer (init T = CL protocol). More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_Exchange (phhalHw_Sam_DataParams_t *pDataParams, uint16_t wOption, uint8_t *pAppDataIn, uint8_t bLenAppData, uint8_t **ppAppDataOut, uint16_t *pAppDataOutLen)
 Perform an exchange bytes with a PICC according ISO14443-4 T = CL protocol. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_PresenceCheck (phhalHw_Sam_DataParams_t *pDataParams)
 Check if an activated card is still in the field. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_Deselect (phhalHw_Sam_DataParams_t *pDataParams, uint8_t bFreeCid)
 Perform de-selection of an activated PICC. More...
 
phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_FreeCid (phhalHw_Sam_DataParams_t *pDataParams, uint8_t *pCid, uint8_t bCidLen)
 Free up one, more, or all currently assigned CIDs. More...
 

Detailed Description

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

Function Documentation

◆ phhalHw_Sam_Cmd_X_ISO14443_4_RATS_PPS()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_RATS_PPS ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bCidIn,
uint8_t  bDsiIn,
uint8_t  bDriIn,
uint8_t pCidOut,
uint8_t pDsiOut,
uint8_t pDriOut,
uint8_t pAts 
)

Perform a combined RATS and PPS sequence to prepare a PICC for T = CL data exchange.

  • The CID assigned to the PICC will be assigned to the current logical channel. This means, every further ISO14443-4 command issued in this logical channel will be executed using this CID automatically
  • If a CID value of FFh is passed to the MIFARE SAM, the MIFARE SAM will automatically assign a CID to the PICC. Therefore it takes already assigned CIDs of other logical channels into account. If a PICC is activated in any other logical channel with an assigned CID of 00h, or not supporting a CID, the PICC will not be activated and the command returns an error. Also all user-defined CIDs will be checked against the already activated PICCs and rejected if the PICC cannot be activated following the ISO/IEC 14443-4 standard.
  • For bit rate selection, the values in the data field define the maximum bit rates. If a PICC does not support these bit rates, the MIFARE SAM will automatically decide the bit rate to apply.
  • The MIFARE SAM returns the actual CID, DRI, DSI and the ATS. If a PICC was activated, which does not support a CID, a CID value of 0 is returned.
  • The MIFARE SAM automatically configures the frame sizes to apply for T=CL data exchanges. As for a bit rate of 848 kbit/s FSD is limited to 96 byte, it is recommended to not indicate a DSI value of 3 in case the PICC is not able to support it, if already known in advance. The activation procedure will succeed since the MIFARE SAM automatically chooses the next applicable bit rate, but since the FSDI value has already to be sent to the PICC in the RATS command, the MIFARE SAM will indicate an FSD of 96 byte supposing that 848 kbit/s will be used for communication. The actually supported bit rate of the PICC is not known to the MIFARE SAM at this time (returned in ATS afterwards) so also if a lower bit rate is selected later on, FSD will be at the non-optimum value of 96 byte.
  • It could happen that the command indicates an error although a PICC has been activated correctly by the RATS command. This is the case if the subsequently sent PPS failed.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpCidOut, pDsiOut, pDriOut and pAts are NULL.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bCidIn[In] CID to be sent.
[in]bDsiIn[In] DSI to be sent. One of the following,
[in]bDriIn[In] DRI to be sent. One of the following,
[out]pCidOut[Out] CID used (1 byte).
[out]pDsiOut[Out] DSI used (1 byte). One of the following,
[out]pDriOut[Out] DRI used (1 byte). One of the following,
[out]pAts[Out] Buffer containing the received ATS (Answer to Select). The length of the ATS can be found on the first position.

◆ phhalHw_Sam_Cmd_X_ISO14443_4_Init()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_Init ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bCid,
uint8_t  bDri,
uint8_t  bDsi,
uint8_t  bFwi,
uint8_t  bFsci 
)

Perform a init of ISO-14443-4 layer (init T = CL protocol).

The intent of this command is to configure the protocol for data exchanges. This is necessary if a PICC was already activated and configured for doing data exchanges without using the ISO14443-4_RATS_PPS command.

  • The CID assigned to the PICC will be assigned to the current logical channel. This means, every further ISO14443-4 command issued in this logical channel, will be executed using this CID automatically. If in any other logical channel a PICC is activated with an assigned CID of 00h or not supporting a CID, the PICC will not be activated and the command returns an error. Also, all user-defined CIDs will be checked against the already activated PICCs and rejected if the PICC cannot be activated following the ISO/IEC 14443-4 standard. If a PICC does not support a CID, this has to be indicated by a CID value of FFh.
  • The MIFARE SAM will automatically adjust FSD according to the DSI input value. The user driving the activation sequence is responsible for indicating the correct FSDI value to the PICC. For details on applied frame sizes pleas refer to ISO14443-4_Exchange
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.
[in]bCid[In] CID to apply. One of the following
  • CID to apply: 0x00 - 0x0E
  • No CID to apply: 0xFF
[in]bDri[In] DSI to be sent. One of the following,
[in]bDsi[In] DRI to be sent. One of the following,
[in]bFwi[In] Frame waiting time indicator (0x00 - 0x0F).
[in]bFsci[In] Frame size card indicator (0x00 - 0x08).

◆ phhalHw_Sam_Cmd_X_ISO14443_4_Exchange()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_Exchange ( phhalHw_Sam_DataParams_t pDataParams,
uint16_t  wOption,
uint8_t pAppDataIn,
uint8_t  bLenAppData,
uint8_t **  ppAppDataOut,
uint16_t pAppDataOutLen 
)

Perform an exchange bytes with a PICC according ISO14443-4 T = CL protocol.

The MIFARE SAM offers the possibility to send more data to a PICC than the maximum data field size. In this case the last frame indicator shall indicate AFh. The MIFARE SAM will then set the chaining bit of the last sent I-block indicating to the PICC that more data will follow and to continue the chaining process after receiving the next command from the host. If more than 256 bytes are to be received from the PICC, the MIFARE SAM will not acknowledge the last received chained I-block from the PICC, returns the data to the host and waits for the next command to continue the chaining process. The following exchange command from the host shall not contain any data, since more data has to be received from the PICC. However, if there is a data field content in the command, the MIFARE SAM will ignore it and continue reception.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_SUCCESS_CHAININGOperation successful with chaining status.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpAppDataIn and pAppDataOutLen are NULL.
PH_ERR_LENGTH_ERRORIf received response length is greater than Maximum Exchange Response length
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]wOption[In] Bufferring Option.
[in]pAppDataIn[In] Buffer containing application data to sent.
[in]bLenAppData[In] Length of bytes available in pAppDataIn buffer.
[out]ppAppDataOut[Out] Buffer containing the data returned by the PICC.
[out]pAppDataOutLen[Out] Length of bytes available in ppAppDataOut buffer.

◆ phhalHw_Sam_Cmd_X_ISO14443_4_PresenceCheck()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_PresenceCheck ( phhalHw_Sam_DataParams_t pDataParams)

Check if an activated card is still in the field.

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_4_Deselect()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_Deselect ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t  bFreeCid 
)

Perform de-selection of an activated PICC.

The CID is freed by this command. If the deselect fails, the CID will not be freed and cannot be used for activating another PICC. This behavior might be overridden by setting a flag in the P1 byte. CIDs can also be freed using the ISO14443-4_FreeCID command.

Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]bFreeCid[In] Bitmask for deselect option.

◆ phhalHw_Sam_Cmd_X_ISO14443_4_FreeCid()

phStatus_t phhalHw_Sam_Cmd_X_ISO14443_4_FreeCid ( phhalHw_Sam_DataParams_t pDataParams,
uint8_t pCid,
uint8_t  bCidLen 
)

Free up one, more, or all currently assigned CIDs.

  • This command might be necessary if several deselect commands failed and the CIDs were not forced to be freed but the PICC is deactivated or no longer available in the field.
  • The command takes at least one CID value in the data field. A CID value of FFh indicates that all CIDs have to be freed. Sending the same CID several times will not cause an error. The command is not related to a logical channel since CIDs are managed in a global pool.
  • Be careful when calling this command. It may free CIDs in logical channels in which PICCs are still activated. The activated PICCs can then no longer be accessed. Freeing the CID additionally causes the MIFARE SAM to reset the state of the logical channel related to the CID, thus the MIFARE SAM clears the indication for an activated PICC.
  • If an incorrect CID (value higher than 14) is detected, the command is aborted. Nevertheless all CIDs which were contained in the data field previous to the incorrect one are freed. The value FFh will cause all CIDs to be freed independent from its occurring position in the data field.
Returns
Status code
Return values
PH_ERR_SUCCESSOperation successful.
PH_ERR_INVALID_DATA_PARAMSpDataParams is NULL.
PH_ERR_INVALID_PARAMETERpCid is NULL.
PH_ERR_LENGTH_ERRORIn case if SAM provides data in response.
OtherDepending on implementation and underlaying component.
Parameters
[in]pDataParams[In] Pointer to this layer's parameter structure.
[in]pCid[In] Buffer containing all CIDs to be freed.
  • CID: 0x00 - 0x0E
  • Free all CIDs: 0xFF
[in]bCidLen[In] Length of bytes available in pCid buffer.