SLOA192B April 2014 – March 2019 TRF7970A , TRF7970A
The NFC_run function switches between target and initiator until an NFC-enabled device is presented to the TRF7970A RF field. Once the peer-to-peer communication is established and eTempNFCState is NFC_DATA_EXCHANGE_PROTOCOL, the firmware checks the RX status with NFC_P2P_getReceiveState() . When a packet is received, the sP2PRxStatus.sDataReceivedStatus will be RECEIVED_FIRST_FRAGMENT, or RECEIVED_N_FRAGMENT, or RECEIVED_FRAGMENT_COMPLETED. When the first fragment is received from another NFC device if the packet is incomplete, the sP2PRxStatus.sDataReceivedStatus will be RECEIVED_FIRST_FRAGMENT. When the first fragment is received from another NFC device if the packet is complete, the sP2PRxStatus.sDataReceivedStatus will be RECEIVED_FRAGMENT_COMPLETED. When the packet is broken into multiple fragments due to the total size being larger than the SNEP queue the sP2PRxStatus.sDataReceivedStatus will be RECEIVED_N_FRAGMENT until the last fragment is received. When the last fragment is received, the sP2PRxStatus.sDataReceivedStatus will be RECEIVED_FRAGMENT_COMPLETED.
eTempNFCState = NFC_run();
if(eTempNFCState == NFC_DATA_EXCHANGE_PROTOCOL)
{
else if(NFC_P2P_getModeStatus(&sP2PMode,&sP2PBitrate))
{
//
// Read the receive status structure - check if there is a received packet from the Target
//
sP2PRxStatus = NFC_P2P_getReceiveState();
if(sP2PRxStatus.sDataReceivedStatus != RECEIVED_NO_FRAGMENT)
{
ui16BytesReceived = sP2PRxStatus.ui16DataReceivedLength + ui16BytesReceived;
// Check if the last packet was received completely
if((uint16_t) sP2PRxStatus.ui32PacketSize == ui16BytesReceived)
{
// Reset Bytes received
ui16BytesReceived = 0;
}
}
}
}