NXP NFC Reader Library v4.040.05.011646

Modules | Macros | Functions
ISO/IEC 18092 Mode Initiator
Protocol Abstraction Layer

These Components implement the ISO/IEC ISO18092 contact-less protocol. More...

Collaboration diagram for ISO/IEC 18092 Mode Initiator:

## Modules
| Component : Software

## Macros
#define | PHPAL_I18092MPI_DID_MAX 0x0EU
| The last valid DID. More...
#define | PHPAL_I18092MPI_WT_MAX 0x0EU
| The maximum allowed WT value, NFCForum-TS-DigitalProtocol-1.0 section 14.11. More...
#define | PHPAL_I18092MPI_FSL_MAX 0x03U
| The maximum allowed FSL value. More...
#define | PHPAL_I18092MPI_PNI_MAX 0x03U
| The maximum allowed PNI value. More...

## Functions
phStatus_t | phpalI18092mPI_ResetProtocol (void *pDataParams)
| Reset the ISO18092 protocol parameters. More...
phStatus_t | phpalI18092mPI_Atr (void *pDataParams, uint8_t *pNfcid3i, uint8_t bDid, uint8_t bLri, uint8_t bNadEnable, uint8_t bNad, uint8_t *pGi, uint8_t bGiLength, uint8_t *pAtrRes, uint8_t *pAtrResLength)
| Perform an ISO18092 "Attribute Request" command. More...
phStatus_t | phpalI18092mPI_Psl (void *pDataParams, uint8_t bDsi, uint8_t bDri, uint8_t bFsl)
| Perform an ISO18092 "Parameter Select" command. More...
phStatus_t | phpalI18092mPI_ActivateCard (void *pDataParams, uint8_t *pNfcid3i, uint8_t bDid, uint8_t bNadEnable, uint8_t bNad, uint8_t bDsi, uint8_t bDri, uint8_t bFsl, uint8_t *pGi, uint8_t bGiLength, uint8_t *pAtrRes, uint8_t *pAtrResLength)
| Perform an ISO18092 ATR and PSL command. More...
phStatus_t | phpalI18092mPI_Deselect (void *pDataParams, uint8_t bDeselectCommand)
| Deselect ISO18092 target by either sending DSL or RLS request. More...
phStatus_t | phpalI18092mPI_PresCheck (void *pDataParams)
| Perform presence check for current target. More...
phStatus_t | phpalI18092mPI_Exchange (void *pDataParams, uint16_t wOption, uint8_t *pTxBuffer, uint16_t wTxLength, uint8_t **ppRxBuffer, uint16_t *pRxLength)
| Perform ISO18092 Data Exchange with target. More...
phStatus_t | phpalI18092mPI_Transmit (void *pDataParams, uint16_t wOption, uint8_t *pTxBuffer, uint16_t wTxLength)
| Perform ISO18092 Data Transmit to target. More...
phStatus_t | phpalI18092mPI_Receive (void *pDataParams, uint16_t wOption, uint8_t **ppRxBuffer, uint16_t *pRxLength)
| Perform ISO18092 Data Exchange with target. More...
phStatus_t | phpalI18092mPI_SetConfig (void *pDataParams, uint16_t wConfig, uint16_t wValue)
| Set configuration parameter. More...
phStatus_t | phpalI18092mPI_GetConfig (void *pDataParams, uint16_t wConfig, uint16_t *pValue)
| Get configuration parameter. More...
phStatus_t | phpalI18092mPI_GetSerialNo (void *pDataParams, uint8_t *pNfcId3Out)
| Retrieve the serial number (NFC ID3). More...
phStatus_t | phpalI18092mPI_Wakeup (void *pDataParams)
| Wakeup ISO18092 Active Target by sending WUP request. More...

## ISO18092 Mode Passive Initiator Parameters
#define | PHPAL_I18092MPI_CONFIG_PACKETNO 0x0000U
| Set / Get packet number.
#define | PHPAL_I18092MPI_CONFIG_DID 0x0001U
| Set / Get Device Identifier.
#define | PHPAL_I18092MPI_CONFIG_NAD 0x0002U
| Set / Get Node Address. More...
#define | PHPAL_I18092MPI_CONFIG_WT 0x0003U
| Set / Get waiting time.
#define | PHPAL_I18092MPI_CONFIG_FSL 0x0004U
| Get frame length (FSL) value. More...
#define | PHPAL_I18092MPI_CONFIG_MAXRETRYCOUNT 0x0005U
| Set / Get maximum retry count.
#define | PHPAL_I18092MPI_CONFIG_ATN 0x0006U
| Set / Get ATN configuration.
#define | PHPAL_I18092MPI_CONFIG_ACTIVEMODE 0x0007U
| Get the status if active communication mode is PH_ON / PH_OFF. More...

## Values for #phpalI18092mPI_Deselect \c bDeselectCommand parameter.
#define | PHPAL_I18092MPI_DESELECT_DSL 0x08U
| DSL is sent for deselection of target. More...
#define | PHPAL_I18092MPI_DESELECT_RLS 0x0AU
| RLS is sent for Release of target. More...

## DRI/DSI (BRI/BSI) Values
#define | PHPAL_I18092MPI_DATARATE_106 0x00U
| DRI/DSI value for 106 kBit/s. More...
#define | PHPAL_I18092MPI_DATARATE_212 0x01U
| DRI/DSI value for 212 kBit/s. More...
#define | PHPAL_I18092MPI_DATARATE_424 0x02U
| DRI/DSI value for 424 kBit/s. More...

## FSL/LRI Values
#define | PHPAL_I18092MPI_FRAMESIZE_64 0x00U
| FSL value for max. More...
#define | PHPAL_I18092MPI_FRAMESIZE_128 0x01U
| FSL value for max. More...
#define | PHPAL_I18092MPI_FRAMESIZE_192 0x02U
| FSL value for max. More...
#define | PHPAL_I18092MPI_FRAMESIZE_254 0x03U
| FSL value for max. More...

## Maximum Values
#define | PHPAL_I18092MPI_MAX_GI_LENGTH 48U
| Maximum length of Gi data. More...

## Detailed Description

These Components implement the ISO/IEC ISO18092 contact-less protocol.

Supported mode is passive initiator, i.e. using these components it is possible to communicate with a passive target in peer to peer mode.

## Macro Definition Documentation

## § PHPAL_I18092MPI_DID_MAX

#define PHPAL_I18092MPI_DID_MAX 0x0EU

The last valid DID.

## § PHPAL_I18092MPI_WT_MAX

#define PHPAL_I18092MPI_WT_MAX 0x0EU

The maximum allowed WT value, NFCForum-TS-DigitalProtocol-1.0 section 14.11.

## § PHPAL_I18092MPI_FSL_MAX

#define PHPAL_I18092MPI_FSL_MAX 0x03U

The maximum allowed FSL value.

## § PHPAL_I18092MPI_PNI_MAX

#define PHPAL_I18092MPI_PNI_MAX 0x03U

The maximum allowed PNI value.

## § PHPAL_I18092MPI_CONFIG_NAD

#define PHPAL_I18092MPI_CONFIG_NAD 0x0002U

Set / Get Node Address.

`wValue` is parsed as follows:

    * NadEnabled = (wValue & 0xFF00) ? 1 : 0;
    * Nad = (wValue & 0x00FF);
    *

## § PHPAL_I18092MPI_CONFIG_FSL

#define PHPAL_I18092MPI_CONFIG_FSL 0x0004U

Get frame length (FSL) value.

Indicates either Lri or Lrt value whichever is lesser in case PSL is not exchanged. If PSL is exchanged then the agreed FSL value is returned.

## § PHPAL_I18092MPI_CONFIG_ACTIVEMODE

#define PHPAL_I18092MPI_CONFIG_ACTIVEMODE 0x0007U

Get the status if active communication mode is PH_ON / PH_OFF.

## § PHPAL_I18092MPI_DESELECT_DSL

#define PHPAL_I18092MPI_DESELECT_DSL 0x08U

DSL is sent for deselection of target.

## § PHPAL_I18092MPI_DESELECT_RLS

#define PHPAL_I18092MPI_DESELECT_RLS 0x0AU

RLS is sent for Release of target.

## § PHPAL_I18092MPI_DATARATE_106

#define PHPAL_I18092MPI_DATARATE_106 0x00U

DRI/DSI value for 106 kBit/s.

## § PHPAL_I18092MPI_DATARATE_212

#define PHPAL_I18092MPI_DATARATE_212 0x01U

DRI/DSI value for 212 kBit/s.

## § PHPAL_I18092MPI_DATARATE_424

#define PHPAL_I18092MPI_DATARATE_424 0x02U

DRI/DSI value for 424 kBit/s.

## § PHPAL_I18092MPI_FRAMESIZE_64

#define PHPAL_I18092MPI_FRAMESIZE_64 0x00U

FSL value for max.

framesize of 64 Bytes.

## § PHPAL_I18092MPI_FRAMESIZE_128

#define PHPAL_I18092MPI_FRAMESIZE_128 0x01U

FSL value for max.

framesize of 128 Bytes.

## § PHPAL_I18092MPI_FRAMESIZE_192

#define PHPAL_I18092MPI_FRAMESIZE_192 0x02U

FSL value for max.

framesize of 192 Bytes.

## § PHPAL_I18092MPI_FRAMESIZE_254

#define PHPAL_I18092MPI_FRAMESIZE_254 0x03U

FSL value for max.

framesize of 254 Bytes.

## § PHPAL_I18092MPI_MAX_GI_LENGTH

#define PHPAL_I18092MPI_MAX_GI_LENGTH 48U

Maximum length of Gi data.

## Function Documentation

## § phpalI18092mPI_ResetProtocol()

phStatus_t phpalI18092mPI_ResetProtocol | ( | void * | pDataParams | ) |

Reset the ISO18092 protocol parameters.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.

## § phpalI18092mPI_Atr()

phStatus_t phpalI18092mPI_Atr | ( | void * | pDataParams,
|  | uint8_t * | pNfcid3i,
|  | uint8_t | bDid,
|  | uint8_t | bLri,
|  | uint8_t | bNadEnable,
|  | uint8_t | bNad,
|  | uint8_t * | pGi,
|  | uint8_t | bGiLength,
|  | uint8_t * | pAtrRes,
|  | uint8_t * | pAtrResLength
| ) |  |

Perform an ISO18092 "Attribute Request" command.

The following values for `bLri` are possible:

- PHPAL_I18092MPI_FRAMESIZE_64
- PHPAL_I18092MPI_FRAMESIZE_128
- PHPAL_I18092MPI_FRAMESIZE_192
- PHPAL_I18092MPI_FRAMESIZE_254

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | pNfcid3i | NFCID3 - randomly generated in case of 106kbps initial datarate or NFCID2 in case of 212/424kbps datarate; uint8_t[10]
  [in] | bDid | Device Identifier; '0' to disable usage else 1-14.
  [in] | bLri | Length Reduction of Initiator; 0-3
  [in] | bNadEnable | Enable usage of Node Address; Unequal '0' to enable.
  [in] | bNad | Node Address; Ignored if bNadEnabled is equal '0'.
  [in] | pGi | Optional General Information bytes.
  [in] | bGiLength | Number of General Information bytes; Not more than PHPAL_I18092MPI_MAX_GI_LENGTH.
  [out] | pAtrRes | Attribute Response; uint8_t[64].
  [out] | pAtrResLength | Attribute Response Length.

## § phpalI18092mPI_Psl()

phStatus_t phpalI18092mPI_Psl | ( | void * | pDataParams,
|  | uint8_t | bDsi,
|  | uint8_t | bDri,
|  | uint8_t | bFsl
| ) |  |

Perform an ISO18092 "Parameter Select" command.

The following values for `bDri` and `bDsi` are possible:

- PHPAL_I18092MPI_DATARATE_106
- PHPAL_I18092MPI_DATARATE_212
- PHPAL_I18092MPI_DATARATE_424

The following values for `bFsl` are possible:

- PHPAL_I18092MPI_FRAMESIZE_64
- PHPAL_I18092MPI_FRAMESIZE_128
- PHPAL_I18092MPI_FRAMESIZE_192
- PHPAL_I18092MPI_FRAMESIZE_254

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | bDsi | Divisor Send (target to initiator) Integer; 0-2
  [in] | bDri | Divisor Receive (initiator to target) Integer; 0-2
  [in] | bFsl | Frame Length Byte; 0-3

## § phpalI18092mPI_ActivateCard()

phStatus_t phpalI18092mPI_ActivateCard | ( | void * | pDataParams,
|  | uint8_t * | pNfcid3i,
|  | uint8_t | bDid,
|  | uint8_t | bNadEnable,
|  | uint8_t | bNad,
|  | uint8_t | bDsi,
|  | uint8_t | bDri,
|  | uint8_t | bFsl,
|  | uint8_t * | pGi,
|  | uint8_t | bGiLength,
|  | uint8_t * | pAtrRes,
|  | uint8_t * | pAtrResLength
| ) |  |

Perform an ISO18092 ATR and PSL command.

The following values for `bDri` and `bDsi` are possible:

- PHPAL_I18092MPI_DATARATE_106
- PHPAL_I18092MPI_DATARATE_212
- PHPAL_I18092MPI_DATARATE_424

The following values for `bFsl` are possible:

- PHPAL_I18092MPI_FRAMESIZE_64
- PHPAL_I18092MPI_FRAMESIZE_128
- PHPAL_I18092MPI_FRAMESIZE_192
- PHPAL_I18092MPI_FRAMESIZE_254

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful, target activated.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | pNfcid3i | NFCID3 - any number in case of 106kbps initial datarate. For 212/424kbps datarate bytes 0 - 7 have to be NFCID2, bytes 8 - 9 need to be set to 0; uint8_t[10]
  [in] | bDid | Device Identifier; '0' to disable usage else 1-14.
  [in] | bNadEnable | Enable usage of Node Address; Unequal '0' to enable.
  [in] | bNad | Node Address; Ignored if bNadEnabled is equal '0'.
  [in] | bDsi | Divisor Send (target to initiator) Integer; 0-7
  [in] | bDri | Divisor Receive (initiator to target) Integer; 0-7
  [in] | bFsl | Frame Length Byte; 0-3
  [in] | pGi | Optional General Information bytes.
  [in] | bGiLength | Number of General Information bytes.
  [out] | pAtrRes | Attribute Response; uint8_t[64].
  [out] | pAtrResLength | Attribute Response Length.

## § phpalI18092mPI_Deselect()

phStatus_t phpalI18092mPI_Deselect | ( | void * | pDataParams,
|  | uint8_t | bDeselectCommand
| ) |  |

Deselect ISO18092 target by either sending DSL or RLS request.

The following values for `bDeselectCommand` are possible:

- PHPAL_I18092MPI_DESELECT_DSL
- PHPAL_I18092MPI_DESELECT_RLS

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful, target deselected.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | bDeselectCommand | Request to send, either PHPAL_I18092MPI_DESELECT_DSL or PHPAL_I18092MPI_DESELECT_RLS.

## § phpalI18092mPI_PresCheck()

phStatus_t phpalI18092mPI_PresCheck | ( | void * | pDataParams | ) |

Perform presence check for current target.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful, target is present.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  PHPAL_I18092MPI_ERR_RECOVERY_FAILED | Recovery failed, target does not respond any more.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.

## § phpalI18092mPI_Exchange()

phStatus_t phpalI18092mPI_Exchange | ( | void * | pDataParams,
|  | uint16_t | wOption,
|  | uint8_t * | pTxBuffer,
|  | uint16_t | wTxLength,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | pRxLength
| ) |  |

Perform ISO18092 Data Exchange with target.

`wOption` can be one of:

- PH_EXCHANGE_DEFAULT
- PH_EXCHANGE_TXCHAINING
- PH_EXCHANGE_RXCHAINING
- PH_EXCHANGE_RXCHAINING_BUFSIZE

Additionally, the following options are also available:

- PH_EXCHANGE_BUFFER_FIRST
- PH_EXCHANGE_BUFFER_CONT
- PH_EXCHANGE_BUFFER_LAST

Alternatively to the FIRST/CONT/LAST options, the following bits can be combined:

- PH_EXCHANGE_BUFFERED_BIT
- PH_EXCHANGE_LEAVE_BUFFER_BIT

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  PHPAL_I18092MPI_ERR_RECOVERY_FAILED | Recovery failed, target does not respond any more.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wOption | Option parameter.
  [in] | pTxBuffer | Data to transmit.
  [in] | wTxLength | Length of data to transmit.
  [out] | ppRxBuffer | Pointer to received data.
  [out] | pRxLength | number of received data bytes.

## § phpalI18092mPI_Transmit()

phStatus_t phpalI18092mPI_Transmit | ( | void * | pDataParams,
|  | uint16_t | wOption,
|  | uint8_t * | pTxBuffer,
|  | uint16_t | wTxLength
| ) |  |

Perform ISO18092 Data Transmit to target.

`wOption` can be one of:

- PH_TRANSMIT_DEFAULT
- PH_TRANSMIT_TXCHAINING

Additionally, the following options are also available:

- PH_TRANSMIT_BUFFER_FIRST
- PH_TRANSMIT_BUFFER_CONT
- PH_TRANSMIT_BUFFER_LAST

Alternatively to the FIRST/CONT/LAST options, the following bits can be combined:

- PH_TRANSMIT_BUFFERED_BIT
- PH_TRANSMIT_LEAVE_BUFFER_BIT

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PHPAL_I18092MPI_ERR_RECOVERY_FAILED | Recovery failed, target does not respond any more.
  Other | Depending on implementation and underlying component.

## § phpalI18092mPI_Receive()

phStatus_t phpalI18092mPI_Receive | ( | void * | pDataParams,
|  | uint16_t | wOption,
|  | uint8_t ** | ppRxBuffer,
|  | uint16_t * | pRxLength
| ) |  |

Perform ISO18092 Data Exchange with target.

`wOption` can be one of:

- PH_RECEIVE_DEFAULT
- PH_RECEIVE_CHAINING
- PH_RECEIVE_CHAINING_BUFSIZE

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  PHPAL_I18092MPI_ERR_RECOVERY_FAILED | Recovery failed, target does not respond any more.
  Other | Depending on implementation and underlying component.

## § phpalI18092mPI_SetConfig()

phStatus_t phpalI18092mPI_SetConfig | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint16_t | wValue
| ) |  |

Set configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration Identifier.
  [in] | wValue | Configuration Value.

## § phpalI18092mPI_GetConfig()

phStatus_t phpalI18092mPI_GetConfig | ( | void * | pDataParams,
|  | uint16_t | wConfig,
|  | uint16_t * | pValue
| ) |  |

Get configuration parameter.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.
  Other | Depending on implementation and underlying component.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [in] | wConfig | Configuration Identifier.
  [out] | pValue | Configuration Value.

## § phpalI18092mPI_GetSerialNo()

phStatus_t phpalI18092mPI_GetSerialNo | ( | void * | pDataParams,
|  | uint8_t * | pNfcId3Out
| ) |  |

Retrieve the serial number (NFC ID3).

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.
  [out] | pNfcId3Out | last NFCID3; uint8_t[10].

## § phpalI18092mPI_Wakeup()

phStatus_t phpalI18092mPI_Wakeup | ( | void * | pDataParams | ) |

Wakeup ISO18092 Active Target by sending WUP request.

Returns
  Status code

Return values

  PH_ERR_SUCCESS | Operation successful, target deselected.
  PH_ERR_PROTOCOL_ERROR | Received response is not ISO/IEC 18092 compliant.
  PH_ERR_IO_TIMEOUT | Timeout waiting for reply, e.g. target removal.
  PHPAL_I18092MPI_ERR_RECOVERY_FAILED | Recovery failed, target does not respond any more.

Parameters

  [in] | pDataParams | Pointer to this layer's parameter structure.