SLOA192B April   2014  – March 2019 TRF7970A , TRF7970A

 

  1.   NFC active and passive peer-to-peer communication using the TRF7970A
    1.     Trademarks
    2. 1  Introduction
    3. 2  Initial RF Collision
    4. 3  TRF7970A Register Settings
    5. 4  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. 5  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. 6  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. 7  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. 8  Quick Start Guide
    10. 9  Operational Overview
    11. 10 Peer-to-Peer Interoperability Results
    12. 11 Conclusion
    13. 12 References
  2.   Revision History

Low-Level Initialization

For the low-level initialization, the MCU is initialized in MCU_init() by setting the MSP430F5529 main clock frequency to 25 MHz. The TRF7970A hardware connections and the MSP430F5529 SPI module (SPI clock running at 4 MHz – minimum recommended is 2 MHz) is initialized in TRF79x0_init(). The local variables are needed for transmit and receive and the peer-to-peer stack initialization. The Buttons_init function set the GPIO direction to inputs and the Buttons_interruptEnable() enable the interrupt for buttons S1 and S2.

#include "msp430.h" #include "nfc_controller.h" #include "ndef_image.h" #include "lp_buttons.h" uint16_t g_ui16ListenTime; t_sNfcP2PMode g_sP2PSupportedModes; t_sNfcP2PCommBitrate g_sP2PSupportedTargetBitrates; t_sNfcP2PCommBitrate g_sP2PSupportedInitiatorBitrates; t_sNfcDEP_P2PSetup g_sP2PSetupOptions; uint8_t g_ui8NfcDepInitiatorDID; void main(void) { tNfcState eTempNFCState; tNfcState eCurrentNFCState; uint32_t ui32PacketRemaining; uint8_t ui8TXBytes; uint16_t ui16TxIndex; uint32_t ui32PacketLength; uint8_t * pui8NdefPointer; uint8_t ui8FragmentSize; // Peer to peer RX Status tNfcP2PRxStatus sP2PRxStatus; t_sNfcP2PMode sP2PMode; t_sNfcP2PCommBitrate sP2PBitrate; // Bytes Received from Peer to Peer uint16_t ui16BytesReceived = 0x00; // Initialize MCU MCU_init(); //Enable interrupts globally __enable_interrupt(); // Initialize TRF7970 TRF79x0_init(); // Initialize S1 and S2 buttons Buttons_init(BUTTON_ALL); Buttons_interruptEnable(BUTTON_ALL); // Initialize TRF7970A Idle Mode TRF79x0_idleMode(); // Initialize the NFC Controller NFC_init(); // This function will configure all the settings for each protocol NFC_configuration(); // Initialize IDs for NFC-A, NFC-B and NFC-F NFC_initIDs();