SLOA192B April   2014  – March 2019 TRF7970A , TRF7970A

 

  1.   NFC active and passive peer-to-peer communication using the TRF7970A
    1.     Trademarks
    2. Introduction
    3. Initial RF Collision
    4. TRF7970A Register Settings
    5. Peer-to-Peer at 106 kbps
      1. 4.1 Active Communication
        1. 4.1.1 Initiator
        2. 4.1.2 Target
      2. 4.2 Passive Communication
        1. 4.2.1 Initiator
        2. 4.2.2 Target
    6. Peer-to-Peer at 212 kbps and 424 kbps
      1. 5.1 Active Communication
        1. 5.1.1 Initiator
        2. 5.1.2 Target
      2. 5.2 Passive Communication
        1. 5.2.1 Initiator
        2. 5.2.2 Target
    7. Hardware Description
      1. 6.1 LaunchPad™ Development Kit and BoosterPack™ Plug-in Module Setup
        1. 6.1.1 BoosterPack Plug-in Module: DLP-7970ABP
        2. 6.1.2 LaunchPad Development Kit: MSP-EXP430F5529LP
        3. 6.1.3 LaunchPad Development Kit: MSP-EXP432P401R
      2. 6.2 Bundle Available for Purchase
    8. Passive and Active Peer-to-Peer Firmware Example
      1. 7.1 Peer-to-Peer APIs
      2. 7.2 Implementing a Peer-to-Peer Sample Application
        1. 7.2.1 Low-Level Initialization
        2. 7.2.2 Peer-to-Peer NFC Stack Setup
        3. 7.2.3 Sending NDEF Packets
        4. 7.2.4 Receiving NDEF Packets
    9. Quick Start Guide
    10. Operational Overview
    11. 10 Peer-to-Peer Interoperability Results
    12. 11 Conclusion
    13. 12 References
  2.   Revision History

Sending NDEF Packets

The NFC_run 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 whether button S1 or button S2 has been pressed. When button S1 is pressed, a text RTD is queued to the SNEP TX buffer. When button S2 is pressed, a MIME RTD is queued to the SNEP TX buffer. When the size of the NDEF packet is smaller than the SNEP queue, the NFC_P2P_sendNdefPacket() is only executed once because the number of remaining bytes return by the function would be 0. When the size of the NDEF packet is larger than the SNEP queue, the NFC_P2P_sendNdefPacket() continues to queue fragments of the complete packet until the number of remaining bytes is 0.

eTempNFCState = NFC_run(); if(eTempNFCState == NFC_DATA_EXCHANGE_PROTOCOL) { else if(NFC_P2P_getModeStatus(&sP2PMode,&sP2PBitrate)) { // Check for button input if ((buttonsPressed & BUTTON_S1) && (buttonDebounce == 2)) { ui16TxIndex = 0x00; buttonDebounce = 0x00; // Total Length of the packet. ui32PacketLength = 46; ui32PacketRemaining = ui32PacketLength; // Send Text String pui8NdefPointer = (uint8_t *) (pui8NfcPoweredByTexasInstruments+2); if(ui32PacketRemaining < LLCP_MIU) { ui8FragmentSize = (uint8_t) ui32PacketRemaining; } else { ui8FragmentSize = LLCP_MIU; } ui8TXBytes = NFC_P2P_sendNdefPacket(pui8NdefPointer,true,ui8FragmentSize,ui32PacketLength); if(ui8TXBytes) { ui32PacketRemaining = ui32PacketRemaining - (uint16_t) (ui8TXBytes); ui16TxIndex = ui16TxIndex + (uint16_t) ui8TXBytes; // Toggle TX LED NFC_TX_LED_POUT ^= NFC_TX_LED_BIT; } } else if((buttonsPressed & BUTTON_S2) && (buttonDebounce == 2)) { ui16TxIndex = 0x00; buttonDebounce = 0x00; // Total Length of the packet. ui32PacketLength = 3597; ui32PacketRemaining = ui32PacketLength; // Send TI Logo pui8NdefPointer = (uint8_t *) (pui8TiLogo + 2); if(ui32PacketRemaining < LLCP_MIU) { ui8FragmentSize = (uint8_t) ui32PacketRemaining; } else { ui8FragmentSize = LLCP_MIU; } ui8TXBytes = NFC_P2P_sendNdefPacket(pui8NdefPointer,true,ui8FragmentSize,ui32PacketLength); if(ui8TXBytes) { ui32PacketRemaining = ui32PacketRemaining - (uint16_t) (ui8TXBytes); ui16TxIndex = ui16TxIndex + (uint16_t) ui8TXBytes; // Toggle TX LED NFC_TX_LED_POUT ^= NFC_TX_LED_BIT; } } else if(ui32PacketRemaining > 0) { if(ui32PacketRemaining < LLCP_MIU) { ui8FragmentSize = (uint8_t) ui32PacketRemaining; } else { ui8FragmentSize = LLCP_MIU; } ui8TXBytes = NFC_P2P_sendNdefPacket((uint8_t *) (pui8NdefPointer+ui16TxIndex),false,ui8FragmentSize,(uint32_t) ui32PacketLength); if(ui8TXBytes) { ui32PacketRemaining = ui32PacketRemaining - (uint16_t) (ui8TXBytes); ui16TxIndex = ui16TxIndex + (uint16_t) ui8TXBytes; // Toggle TX LED NFC_TX_LED_POUT ^= NFC_TX_LED_BIT; } } else if(buttonDebounce == 0x00) { // Enable the button debounce. buttonDebounce = 0x01; } else if (ui32PacketRemaining == 0) { // Clear TX LED NFC_TX_LED_POUT &= ~NFC_TX_LED_BIT; } } }