Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
NFC-DEP
[RFAL-AL]
RFAL NFC-DEP Module. More...
Data Structures | |
| struct | rfalNfcDepConfigs |
| struct | rfalNfcDepAtrReq |
| struct | rfalNfcDepAtrRes |
| struct | rfalNfcDepBufFormat |
| union | rfalNfcDepActivation |
| struct | rfalNfcDepInfo |
| struct | rfalNfcDepDevice |
| struct | rfalNfcDepAtrParam |
| struct | rfalNfcDepListenActvParam |
| struct | rfalNfcDepTargetParam |
| struct | rfalNfcDepTxRxParam |
Typedefs | |
| typedef bool(* | rfalNfcDepDeactCallback )(void) |
Enumerations | |
| enum | { RFAL_NFCDEP_Bx_NO_HIGH_BR = 0x00, RFAL_NFCDEP_Bx_08_848 = 0x01, RFAL_NFCDEP_Bx_16_1695 = 0x02, RFAL_NFCDEP_Bx_32_3390 = 0x04, RFAL_NFCDEP_Bx_64_6780 = 0x08 } |
| enum | { RFAL_NFCDEP_Dx_01_106 = RFAL_BR_106, RFAL_NFCDEP_Dx_02_212 = RFAL_BR_212, RFAL_NFCDEP_Dx_04_424 = RFAL_BR_424, RFAL_NFCDEP_Dx_08_848 = RFAL_BR_848, RFAL_NFCDEP_Dx_16_1695 = RFAL_BR_1695, RFAL_NFCDEP_Dx_32_3390 = RFAL_BR_3390, RFAL_NFCDEP_Dx_64_6780 = RFAL_BR_6780 } |
| enum | { RFAL_NFCDEP_LR_64 = 0x00, RFAL_NFCDEP_LR_128 = 0x01, RFAL_NFCDEP_LR_192 = 0x02, RFAL_NFCDEP_LR_254 = 0x03 } |
| enum | rfalNfcDepCommMode { RFAL_NFCDEP_COMM_PASSIVE, RFAL_NFCDEP_COMM_ACTIVE } |
| enum | rfalNfcDepRole { RFAL_NFCDEP_ROLE_INITIATOR, RFAL_NFCDEP_ROLE_TARGET } |
Functions | |
| void | rfalNfcDepInitialize (void) |
| NFCIP Initialize. | |
| void | rfalNfcDepSetDeactivatingCallback (rfalNfcDepDeactCallback pFunc) |
| Set deactivating callback. | |
| uint32_t | rfalNfcDepCalculateRWT (uint8_t wt) |
| Calculate Response Waiting Time. | |
| ReturnCode | rfalNfcDepATR (rfalNfcDepAtrParam *param, rfalNfcDepAtrRes *atrRes, uint8_t *atrResLen, SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| NFC-DEP Initiator ATR (Attribute Request) | |
| ReturnCode | rfalNfcDepPSL (uint8_t BRS, uint8_t FSL, SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| NFC-DEP Initiator PSL (Parameter Selection) | |
| ReturnCode | rfalNfcDepDSL (SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| NFC-DEP Initiator DSL (Deselect) | |
| ReturnCode | rfalNfcDepRLS (SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| NFC-DEP Initiator RLS (Release) | |
| ReturnCode | rfalNfcDepInitiatorHandleActivation (rfalNfcDepAtrParam *param, rfalBitRate desiredBR, rfalNfcDepDevice *nfcDepDev, SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| NFC-DEP Initiator Handle Activation. | |
| bool | rfalNfcDepIsAtrReq (uint8_t *buf, uint16_t bufLen, uint8_t *nfcid3) |
| Check if buffer contains valid ATR_REQ. | |
| bool | rfalNfcDepTargetRcvdATR (void) |
| Check is Target has received ATR. | |
| ReturnCode | rfalNfcDepListenStartActivation (rfalNfcDepTargetParam *param, uint8_t *atrReq, uint16_t atrReqLength, rfalNfcDepListenActvParam rxParam, SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| NFCDEP Start Listen Activation Handling. | |
| ReturnCode | rfalNfcDepListenGetActivationStatus (SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| Get the current NFC-DEP Activation Status. | |
| ReturnCode | rfalNfcDepStartTransceive (rfalNfcDepTxRxParam *param) |
| Start Transceive. | |
| ReturnCode | rfalNfcDepGetTransceiveStatus (SPI *mspiChannel, ST25R3911 *mST25, DigitalOut *gpio_cs, InterruptIn *IRQ, DigitalOut *fieldLED_01, DigitalOut *fieldLED_02, DigitalOut *fieldLED_03, DigitalOut *fieldLED_04, DigitalOut *fieldLED_05, DigitalOut *fieldLED_06) |
| Return the Transceive status. | |
Detailed Description
RFAL NFC-DEP Module.
Typedef Documentation
| typedef bool(* rfalNfcDepDeactCallback)(void) |
NFC-DEP callback to check if upper layer has deactivation pending
Definition at line 225 of file rfal_nfcDep.h.
Enumeration Type Documentation
| anonymous enum |
Enumeration of NFC-DEP bit rate in ATR Digital 1.0 Table 93 and 94
- Enumerator:
Definition at line 191 of file rfal_nfcDep.h.
| anonymous enum |
Enumeration of NFC-DEP bit rate Dividor in PSL Digital 1.0 Table 100
- Enumerator:
Definition at line 200 of file rfal_nfcDep.h.
| anonymous enum |
Enumeration of NFC-DEP Length Reduction (LR) Digital 1.0 Table 91
- Enumerator:
Definition at line 211 of file rfal_nfcDep.h.
| enum rfalNfcDepCommMode |
Enumeration of the nfcip communication modes
- Enumerator:
RFAL_NFCDEP_COMM_PASSIVE Passive communication mode
RFAL_NFCDEP_COMM_ACTIVE Active communication mode
Definition at line 229 of file rfal_nfcDep.h.
| enum rfalNfcDepRole |
Enumeration of the nfcip roles
- Enumerator:
RFAL_NFCDEP_ROLE_INITIATOR Perform as Initiator
RFAL_NFCDEP_ROLE_TARGET Perform as Target
Definition at line 236 of file rfal_nfcDep.h.
Function Documentation
| ReturnCode rfalNfcDepATR | ( | rfalNfcDepAtrParam * | param, |
| rfalNfcDepAtrRes * | atrRes, | ||
| uint8_t * | atrResLen, | ||
| SPI * | mspiChannel, | ||
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
NFC-DEP Initiator ATR (Attribute Request)
This method configures the NFC-DEP layer with given parameters and then sends an ATR to the Target with and checks for a valid response response
- Parameters:
-
[in] param : parameters to initialize and compose the ATR [out] atrRes : location to store the ATR_RES [out] atrResLen : length of the ATR_RES received
- Returns:
- ERR_NONE : No error
- ERR_TIMEOUT : Timeout occurred
- ERR_PROTO : Protocol error occurred
Definition at line 1919 of file rfal_nfcDep.cpp.
| uint32_t rfalNfcDepCalculateRWT | ( | uint8_t | wt ) |
Calculate Response Waiting Time.
Calculates the Response Waiting Time (RWT) from the given Waiting Time (WT)
- Parameters:
-
[in] wt : the WT value to calculate RWT
- Returns:
- RWT value
Definition at line 2278 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepDSL | ( | SPI * | mspiChannel, |
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
NFC-DEP Initiator DSL (Deselect)
This method checks if the NFCIP module is configured as initiator and if so sends a DSL REQ, waits the target's response and checks it
In case of performing as target no action is taken
- Returns:
- ERR_NONE : No error
- ERR_TIMEOUT : Timeout occurred
- ERR_MAX_RERUNS : Timeout occurred
- ERR_PROTO : Protocol error occurred
Definition at line 2053 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepGetTransceiveStatus | ( | SPI * | mspiChannel, |
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
Return the Transceive status.
Returns the status of the NFC-DEP Transceive
- Warning:
- When the other device is performing chaining once a chained block is received the error ERR_AGAIN is sent. At this point caller must handle the received data immediately. When ERR_AGAIN is returned an ACK has already been sent to the other device and the next block might be incoming. If rfalWorker() is called frequently it will place the next block on the given buffer
- Returns:
- ERR_NONE : Transceive has been completed successfully
- ERR_BUSY : Transceive is ongoing
- ERR_PROTO : Protocol error occurred
- ERR_TIMEOUT : Timeout error occurred
- ERR_SLEEP_REQ : Deselect has been received and responded
- ERR_NOMEM : The received I-PDU does not fit into the receive buffer
- ERR_LINK_LOSS : Communication is lost because Reader/Writer has turned off its field
- ERR_AGAIN : received one chaining block, continue to call this method to retrieve the remaining blocks
Definition at line 2483 of file rfal_nfcDep.cpp.
| void rfalNfcDepInitialize | ( | void | ) |
NFCIP Initialize.
This method resets all NFC-DEP inner states, counters and context and sets default values
Definition at line 1672 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepInitiatorHandleActivation | ( | rfalNfcDepAtrParam * | param, |
| rfalBitRate | desiredBR, | ||
| rfalNfcDepDevice * | nfcDepDev, | ||
| SPI * | mspiChannel, | ||
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
NFC-DEP Initiator Handle Activation.
This performs a Activation into NFC-DEP layer with the given parameters. It sends ATR_REQ and if the higher bit rates are supported by both devices it additionally sends PSL Once Activated all details of the device are provided on nfcDepDev
- Parameters:
-
[in] param : required parameters to initialize and send ATR_REQ [in] desiredBR : Desired bit rate supported by the Poller [out] nfcDepDev : NFC-DEP information of the activated Listen device
- Returns:
- ERR_WRONG_STATE : RFAL not initialized or incorrect mode
- ERR_PARAM : Invalid parameters
- ERR_IO : Generic internal error
- ERR_TIMEOUT : Timeout error
- ERR_PAR : Parity error detected
- ERR_CRC : CRC error detected
- ERR_FRAMING : Framing error detected
- ERR_PROTO : Protocol error detected
- ERR_NONE : No error, activation successful
Definition at line 2137 of file rfal_nfcDep.cpp.
| bool rfalNfcDepIsAtrReq | ( | uint8_t * | buf, |
| uint16_t | bufLen, | ||
| uint8_t * | nfcid3 | ||
| ) |
Check if buffer contains valid ATR_REQ.
This method checks if the given ATR_REQ is valid
- Parameters:
-
[in] buf : buffer holding Initiator's received request [in] bufLen : size of the msg contained on the buf in Bytes [out] nfcid3 : pointer to where the NFCID3 may be outputed, nfcid3 has NFCF_SENSF_NFCID3_LEN as length Pass NULL if output parameter not desired
- Returns:
- true : Valid ATR_REQ received, the ATR_RES has been computed in txBuf
- false : Invalid protocol request
Definition at line 1770 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepListenGetActivationStatus | ( | SPI * | mspiChannel, |
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
Get the current NFC-DEP Activation Status.
- Returns:
- ERR_NONE : Activation has completed successfully
- ERR_BUSY : Activation is ongoing
- ERR_LINK_LOSS : Remote Field was turned off
Definition at line 2412 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepListenStartActivation | ( | rfalNfcDepTargetParam * | param, |
| uint8_t * | atrReq, | ||
| uint16_t | atrReqLength, | ||
| rfalNfcDepListenActvParam | rxParam, | ||
| SPI * | mspiChannel, | ||
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
NFCDEP Start Listen Activation Handling.
Start Activation Handling and setup to receive first frame which may contain complete or partial DEP-REQ after activation is completed
Pass in ATR_REQ for NFC-DEP to handle ATR_RES. The Activation Handling handles ATR_RES and PSL_RES if a PSL_REQ is received
Activation is completed if PSL_RES is sent or if first I-PDU is received
rfalNfcDepListenGetActivationStatus() provide status of the ongoing activation
- Warning:
- nfcDepGetTransceiveStatus() shall be called right after activation is completed (i.e. rfalNfcDepListenGetActivationStatus() return ERR_NONE) to check for first received frame.
- Parameters:
-
[in] param : Target parameters to be used [in] atrReq : reference to buffer containing ATR_REQ [in] atrReqLength,: Length of ATR_REQ [out] rxParam : references to buffer, length and chaining indication for first complete LLCP to be received
- Returns:
- ERR_NONE : ATR_REQ is valid and activation ongoing
- ERR_PARAM : ATR_REQ or other params are invalid
- ERR_LINK_LOSS : Remote Field is turned off
Definition at line 2327 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepPSL | ( | uint8_t | BRS, |
| uint8_t | FSL, | ||
| SPI * | mspiChannel, | ||
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
NFC-DEP Initiator PSL (Parameter Selection)
This method sends a PSL to the Target with the given parameters and checks for a valid response response
The parameters must be coded according to Digital 1.1 16.7.1
- Parameters:
-
[in] BRS : the selected Bit Rates for Initiator and Target [in] FSL : the maximum length of Commands and Responses
- Returns:
- ERR_NONE : No error
- ERR_TIMEOUT : Timeout occurred
- ERR_PROTO : Protocol error occurred
Definition at line 2002 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepRLS | ( | SPI * | mspiChannel, |
| ST25R3911 * | mST25, | ||
| DigitalOut * | gpio_cs, | ||
| InterruptIn * | IRQ, | ||
| DigitalOut * | fieldLED_01, | ||
| DigitalOut * | fieldLED_02, | ||
| DigitalOut * | fieldLED_03, | ||
| DigitalOut * | fieldLED_04, | ||
| DigitalOut * | fieldLED_05, | ||
| DigitalOut * | fieldLED_06 | ||
| ) |
NFC-DEP Initiator RLS (Release)
This method checks if the NFCIP module is configured as initiator and if so sends a RLS REQ, waits target's response and checks it
In case of performing as target no action is taken
- Returns:
- ERR_NONE : No error
- ERR_TIMEOUT : Timeout occurred
- ERR_MAX_RERUNS : Timeout occurred
- ERR_PROTO : Protocol error occurred
Definition at line 2096 of file rfal_nfcDep.cpp.
| void rfalNfcDepSetDeactivatingCallback | ( | rfalNfcDepDeactCallback | pFunc ) |
Set deactivating callback.
Sets the deactivating callback so that nfcip layer can check if upper layer has a deactivation pending, and not perform error recovery upon specific errors
- Parameters:
-
[in] pFunc : method pointer to deactivation flag check
Definition at line 1665 of file rfal_nfcDep.cpp.
| ReturnCode rfalNfcDepStartTransceive | ( | rfalNfcDepTxRxParam * | param ) |
Start Transceive.
Transceives a complete or partial DEP block
The txBuf contains complete or partial of DEP to be transmitted. The Prologue field of the I-PDU is handled internally
If the buffer contains partial LLCP and is not the last block, then isTxChaining must be set to true
- Parameters:
-
[in] param,: reference parameters to be used for the Transceive
- Returns:
- ERR_PARAM : Bad request
- ERR_WRONG_STATE : The module is not in a proper state
- ERR_NONE : The Transceive request has been started
Definition at line 2457 of file rfal_nfcDep.cpp.
| bool rfalNfcDepTargetRcvdATR | ( | void | ) |
Check is Target has received ATR.
This method checks if the NFCIP module is configured as target and if a ATR REQ has been received ( whether is in activation or in data exchange)
- Returns:
- true : a ATR has already been received
- false : no ATR has been received
Definition at line 1763 of file rfal_nfcDep.cpp.
Generated on Sat Jul 16 2022 13:00:53 by
1.7.2