• Menu
  • Product
  • Email
  • PDF
  • Order now
  • NFC active and passive peer-to-peer communication using the TRF7970A

    • SLOA192B April   2014  – March 2019 TRF7970A , TRF7970A

       

  • CONTENTS
  • SEARCH
  • NFC active and passive peer-to-peer communication using the 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
  3. IMPORTANT NOTICE
search No matches found.
  • Full reading width
    • Full reading width
    • Comfortable reading width
    • Expanded reading width
  • Card for each section
  • Card with all content

 

APPLICATION NOTE

NFC active and passive peer-to-peer communication using the TRF7970A

NFC active and passive peer-to-peer communication using the TRF7970A

Peer-to-peer (P2P) is one of the three modes supported by the TRF7970A. The Near Field Communication (NFC) market is emerging into multiple fields including medical, consumer, retail, industrial, automotive, and smart grid. P2P is very common in these fields, because it allows for a wireless virtual channel to be created between two devices. This application report describes two NFC technologies, the NFC-F and NFC-A protocols, which are used to initiate the communication for peer-to-peer active or passive modes. Furthermore, this application report explains how to implement an application using active or passive P2P communication, supporting baud rates of 106 kbps, 212 kbps and 424 kbps on the TRF7970A transceiver.

Project collateral and source code discussed in this application report can be downloaded from http://www.ti.com/lit/zip/sloa192.

first_page_sloa192.gif

Trademarks

BoosterPack, LaunchPad are registered trademarks of Texas Instruments.

FeliCa is a registered trademark of Sony Corporation.

All other trademarks are the property of their respective owners.

1 Introduction

The TRF7970A supports three modes: reader/writer, card emulation, and peer-to-peer. This document describes how to use the TRF7970A in peer-to-peer (P2P) active or passive. P2P requires two NFC-enabled devices to communicate using technologies NFC-A or NFC-F at baud rates of 106 kbps (NFC-A), 212 kbps (NFC-F), or 424 kbps (NFC-F). The transceiver that is initially polling and initiates the communication is the initiator. The transceiver that is initially listening is the target.

The initiator always generates the RF field for both active and passive communication modes. However, the target generates its own RF field only for active mode (while the initiator's RF field is disabled) and load modulates the initiator's RF field in passive mode. After the technology selection for either mode has been completed, the higher layers are the same (as shown in Figure 1). The NDEF Push Protocol (NPP) was commonly used on Gingerbread Android NFC devices as the protocol to push NDEF messages from one NFC device to another; however, the Simple NDEF Exchange Protocol (SNEP) has become the standard on Ice Cream Sandwich Android NFC devices and onward.

peer_to_peer_layers_including_the_PHY_TRF7970A_sloa192.gifFigure 1. Peer-to-Peer Layers Including the PHY (TRF7970A)

A 16-bit and a 32-bit microcontroller are used to interface with the TRF7970A to demonstrate a reference example of the peer-to-peer mode. The firmware supports flexible functions that let the user enable or disable different peer-to-peer modes and technologies. The firmware supports both initiator and target for active and passive communication at baud rates of 106 kbps, 212 kbps, and 424 kbps. Additionally, the firmware can send and receive NDEF messages from NFC-enabled smart phones with SNEP.

Table 1 lists the NFC-enabled devices used to validate the firmware.

Table 1. NFC Enabled Devices Used to Test Peer-to-Peer

Smartphone Model (Release Date) Operating System Kernel Version
Samsung Galaxy Nexus (Nov 2011) Android 4.3 3.0.72 Jun 7 2013
Samsung Galaxy S3 (T-Mobile) (May 2012) Android 4.0.4 3.031 Oct 31 2013
Asus Nexus 7 (July 2012) Android 4.4.2 3.1.10 Nov 20 2013
Samsung Galaxy Note 2 (Sept 2012) Android 4.3 3.0.31 Nov 19 2013
AU Arrows Fujitsu FJL21 (Oct 2012) Android 4.0.4 3.0.21 Oct 16 2012
Nokia Lumia 820 (Oct 2012) Windows 8 8.0.10211.204
HP Elite Tablet (Nov 2012) Windows 8 Windows 8 Pro
Samsung Nexus 10 (Nov 2012) Android 4.4.2 3.4.39 Nov 20 2013
Google Nexus 4 (Nov 2012) Android 4.3 3.4.0 Nov 20 2013
Samsung Galaxy S4 (April 2013) Android 4.3 3.4.0 Nov 16 2013
Hisense Sero 7 Pro (June 2013) Android 4.2.1 3.1.10
Asus Nexus 7 (July 2013) Android 4.4 3.4.0 Dec 11 2013
Google Nexus 5 (Oct 2013) Android 4.4 3.4.0 Nov 20 2013

2 Initial RF Collision

Various implementations of peer-to-peer exist today; these implementations may poll through commands at different time intervals (500 ms, 300 ms, and so forth). To ensure that two NFC devices do not send commands at the same time, an initial RF collision detection is required. The transceiver must check the external Received Signal Strength Indicator (RSSI) value, which measures the strength of the demodulated subcarrier signal, before enabling its own RF field. If the RSSI value is greater than 0x00, the transceiver does not enable its RF field.

The relation between the 3-bit code and the external RF field strength (A/m) sensed by the antenna must be determined by calculation or by experiments for each antenna design. The antenna Q-factor, coupling factor between the two antennas, and connection to the RF input influence the result. Figure 3 through Figure 5 provide the correlation of the free space distance between two unmodified TRF7970ATB modules and the 3-bit external RSSI value in three directions. For more details on each orientation, see Figure 2. One TRF7970A has its RF field at full power (+23 dBm), and the second TRF7970A is used to take RSSI measurements across different distances.

RSSI_level_measurement_orientations_sloa192.gifFigure 2. RSSI Level Measurement Orientations
long_side_RSSI_level_measurement_sloa192.gifFigure 3. Long Side RSSI Level Measurement
short_side_RSSI_level_measurement_sloa192.gifFigure 4. Short Side RSSI Level Measurement
top_side_RSSI_level_measurement_sloa192.gifFigure 5. Top-Side RSSI Level Measurement

The initial RF collision can be accomplished by performing the following steps:

  1. Write 0x02 and 0x03 (3-VDC and 5-VDC operation) to the Chip Status Control register (0x00) disabling the transmitter and enabling the receiver.
  2. Send a Test External RF Direct command (0x19).
  3. Delay 50 µs to allow the transceiver to measure the field strength, and latch the value into the RSSI register.
  4. Read the RSSI Levels and Oscillator Status register (0x0F).
  5. If the active channel RSSI value (bits 2-0) is greater than 0, remain in target mode for a predetermined n ms.
  6. If the active channel RSSI value (bits 2-0) is equal to 0, go into initiator or target mode for active or passive communication.

3 TRF7970A Register Settings

After powering up the TRF7970A, the MCU must send SOFT_INIT (0x03) and IDLE (0x00) direct commands to enable the passive target mode at 106 kbps. Table 2 shows the default value of registers 0x00 through 0x16 and 0x18 through 0x1C after the commands are issued. The table also shows the registers that must be modified for both target and initiator modes.

The ISO Control (0x01) register is modified whenever the peer-to-peer technology or bit rate changes. The Chip Status Control (0x00) register is modified after initialization and whenever the RF field is enabled or disabled. The Modulator and SYS_CLK Control (0x09), RX Special Settings (0x0A), and Regulator and I/O Control (0x0B) registers need to be modified only once, right after initialization. The NFC Low Field Detection Level (0x16) register needs to be modified only for Target mode operation. The NFC Target Detection Level (0x18) register must be modified after initialization for Target mode operation, and also for Initiator mode operation based on the TRF7970A silicon errata.

Table 2. TRF7970A Default Register Values After Receiving SOFT_INIT and IDLE Direct Commands

Address Register Value Notes Requires Modification
Initiator Target
0x00 Chip status control 0x01 5-V operation Yes Yes
0x01 ISO control 0x21 Passive target Yes Yes
0x02 ISO14443B TX options 0x00 Automatic single device detection (SDD) disabled No No
0x03 ISO14443A high bit-rate options 0x00 See TRF7970A data sheet No No
0x04 TX timer setting, H-byte 0xC1 See TRF7970A data sheet No No
0x05 TX timer setting, L-byte 0xC1 See TRF7970A data sheet No No
0x06 TX pulse-length control 0x00 See TRF7970A data sheet No No
0x07 RX no response wait 0x0E See TRF7970A data sheet No No
0x08 RX wait time 0x07 See TRF7970A data sheet No No
0x09 Modulator and SYS_CLK control 0x91 27-MHz crystal enabled, SYS_CLK enabled, OOK (100%) Yes Yes
0x0A RX special setting 0x10 Band-pass 100 kHz to 1.5 MHz Yes Yes
0x0B Regulator and I/O control 0x87 Automatic VDD RF Yes Yes
0x0C IRQ status 0x00 See TRF7970A data sheet No No
0x0D Collision position and interrupt mask 0x3E See TRF7970A data sheet No No
0x0E Collision position 0x00 See TRF7970A data sheet No No
0x0F RSSI levels and oscillator status 0x40 See TRF7970A data sheet No No
0x10 Special function 0x00 See TRF7970A data sheet No No
0x11 Special function 0x00 See TRF7970A data sheet No No
0x12 RAM 0x00 See TRF7970A data sheet No No
0x13 RAM 0x00 See TRF7970A data sheet No No
0x14 Adjustable FIFO IRQ levels 0x00 See TRF7970A data sheet Optional Optional
0x15 Reserved 0x00 N/A No No
0x16 NFC low field detection level 0x00 See TRF7970A data sheet No Yes
0x18 NFC target detection level 0x00 See TRF7970A data sheet Yes Yes
0x19 NFC target protocol 0x00 See TRF7970A data sheet No No
0x1A Test 0x00 See TRF7970A data sheet No No
0x1B Test 0x00 See TRF7970A data sheet No No
0x1C FIFO status 0x00 See TRF7970A data sheet No No

4 Peer-to-Peer at 106 kbps

The TRF7970A supports initiator and target P2P mode at 106 kbps (fc/128). When the transceiver is in default mode [ISO mode (for more information, see the Direct Mode section of [1])] only the decoded data is available to the MCU through the FIFO. The frame format for Data Exchange Protocol (DEP) packets at 106 kbps (shown in Figure 6) are based on the NFC-A technology specified in the NFCForum-TS-DigitalProtocol-1.0. The format does not include the Start Byte for the passive anticollision of 106 kbps. This section covers the register settings and anticollision sequence for both the active and passive peer-to-peer modes at 106 kbps.

frame_format_for_106bps_sloa192.gifFigure 6. Frame Format for 106 kbps
peer_to_peer_106kbps_flow_diagram_sloa192.gifFigure 7. Peer-to-Peer 106-kbps Flow Diagram

4.1 Active Communication

The TRF7970A ISO Control register (0x01) sets the modulation of the transceiver's RF field when is in initiator mode or active NFC target. The NFC initiator and active target for baud rate of 106 kbps can be achieved by initializing the transceiver as a NFC-A RFID reader (0x08). Each time the transceiver finishes sending a command while being an initiator and active Target it must:

  1. Turn off the field by modifying the ISO Control register → 0x21 (passive target).
  2. Write to the RX Special Setting register (0x0A) → 0x30 (band-pass 450 kHz to 1.5 MHz and band-pass 100 kHz to 1.5 MHz).
  3. Write to the Adjustable FIFO IRQ Levels register (0x14) → 0x0F (IRQ triggered when there are 96 bytes in FIFO during RX or 32 bytes during TX).

4.1.1 Initiator

Once the Initial RF Collision avoidance is completed and no RF field has been detected (see Figure 7), the following registers must be modified each time before a DEP_REQ is sent to the active target (see Figure 8). For more information, see Section 2.

  1. Delay time specified in the technology specification (56 µs to 188 µs).
  2. ISO Control register (0x01) → 0x08 (ISO1443A at 106 kbps, receive with CRC).
  3. Delay 1 ms.
  4. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission with (0x11) or without (0x10) CRC direct command.
    3. TX Length Byte 1 (0x1D) and TX Length Byte 2 (0x1E) registers.
    4. Write the command to the FIFO.

4.1.2 Target

After receiving commands from the initiator, the transceiver must follow the next steps each time before responding to the initiator:

  1. Delay time specified in the technology specification (56 µs to 188 µs).
  2. Perform Response RF Collision avoidance, and ensure no RF field is detected.
  3. ISO Control register (0x01) → 0x08 (ISO14443A at 106 kbps, receive with CRC).
  4. Delay 1 ms
  5. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission with (0x11) or without (0x10) CRC direct command.
    3. TX Length Byte 1 and 2 (0x1D and 0x1E) registers.
    4. Write the response to the FIFO.
  6. peer_to_peer_106kbps_initiator_anti_collision_for_active_comm_sloa192.gifFigure 8. Peer-to-Peer 106-kbps Initiator Anticollision for Active Communication

4.2 Passive Communication

The TRF7970A ISO Control register (0x01) sets the modulation of the transceiver RF field when is in initiator mode and the bit rate at which to load modulate when it is in target mode. Unlike active communication, the target load modulates the initiator RF field instead of modulating its own field. Furthermore, the anticollision procedure is different for passive communication at 106 kbps.

4.2.1 Initiator

When the initial RF collision is completed and no RF field has been detected (as shown in Figure 7), the following registers must be modified before and after the anticollision is completed as shown in Figure 9. For more information, see Section 2.

  1. ISO Control register (0x01) → 0x88 (ISO14443A 106 kbps, receive without CRC during anticollision, before Select command)
    or
    ISO Control register (0x01) → 0x08 (ISO14443A 106 kbps, receive with CRC after anticollision is completed).
  2. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission without (0x10, anticollision before Select command) or with (0x11, after anticollision is completed) CRC direct command.
    3. TX Length Byte 1 (0x1D) and TX Length Byte 2 (0x1E) registers.
    4. Write the command to the FIFO.

Unlike the active communication, no further RF collisions are required. The ISO control register needs to be modified for the anticollision state to receive without CRC for the required commands. For more information, see the ISO14443-3 specification. Once the anticollision is completed the ISO Control register needs to be modified to receive with CRC. Step 2 must be used to send commands to the passive target.

4.2.2 Target

Initially the TRF7970A must be receiving without CRC. After receiving commands from the initiator, the following registers must be modified before and after the anticollision is completed:

  1. ISO Control register (0x01) → 0xA4 (ISO14443A 106 kbps, receive without CRC during anticollision, before Select command)
    or
    ISO Control register (0x01) → 0x24 (ISO14443A 106 kbps, receive with CRC, after anticollision is completed).
  2. 2. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission without (0x10, anticollision before Select command) or with (0x11, after anticollision is completed) CRC direct command.
    3. c. TX Length Byte 1 and 2 (0x1D and 0x1E) registers.
    4. Write the command to the FIFO.

The ISO control register needs to be modified for the anticollision state to receive without CRC for the required commands. For more information, see the ISO14443-3 specification. Once the anticollision is completed the ISO Control register needs to be modified to receive with CRC. Step 2 must be used to send commands to the initiator.

peer_to_peer_106kbps_initiator_anti_collision_for_passive_comm_sloa192.gifFigure 9. Peer-to-Peer 106-kbps Initiator Anticollision for Passive Communication

5 Peer-to-Peer at 212 kbps and 424 kbps

The TRF7970A supports initiator and target for NFC-F FeliCa™ at 212 kbps (fc/64) and 424 kbps (fc/32). When the transceiver is in default mode [ISO mode (for more information, see the Direct Mode section of [1])] the decoded data is available to the MCU through the FIFO. The frame format for 212 kbps and 424 kbps is shown in Figure 10. This section covers the register settings and anticollision sequence for both the active and passive NFC-F peer-to-peer modes.

frame_format_for_212_424_bps_sloa192.gifFigure 10. Frame Format for 212 kbps and 424 kbps
peer_to_peer_212_or_424kbps_initiator_anti_coll_sloa192.gifFigure 11. Peer-to-Peer 212-kbps or 424-kbps Initiator Anticollision for Active Communication

5.1 Active Communication

The TRF7970A ISO Control register (0x01) sets the modulation of the transceiver RF field when is in initiator mode and the bit rate to load modulate when it is in target mode. The NFC active and passive initiator (bit 5 = 1 and bit 2 = 1) for baud rates of 212 kbps and 424 kbps, can be achieved by initializing the transceiver as a NFC-F reader (Bit 5 = 1 and bits 4-0 = 0x12 (212 kbps) or 0x13 (424 kbps)). Each time the transceiver finishes sending a command while being an initiator or target, the transceiver must:

  1. Turn off the field by modifying the ISO Control register → 0x21 (passive target).
  2. Write to RX Special Setting register (0x0A) → 0x80 (band-pass filter set for 110 kHz to 570 kHz)
  3. Write to Adjustable FIFO IRQ Levels register (0x14) → 0x0F (IRQ triggered when there are 96 bytes in FIFO during RX or 32 bytes during TX)

5.1.1 Initiator

Once the Initial RF Collision is completed and no RF field has been detected (as shown in Figure 11), the following registers must be modified to initialize the anticollision (as shown in Figure 12). For more information, see Section 2.

  1. Delay time specified in the technology specification (56 µs to 188 µs).
  2. ISO Control register (0x01) → 0x32 (NFC-F at 212 kbps, receive with CRC).
  3. Delay 1 ms
  4. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission with CRC direct command (0x11).
    3. TX Length Byte 1 and 2 (0x1D and 0x1E) registers.
    4. Write the response to the FIFO.

5.1.2 Target

After receiving commands from the initiator, the transceiver must follow the next steps each time before responding to the initiator:

  1. Delay time specified in the technology specification (56 µs to 188 µs).
  2. Perform Response RF Collision avoidance, and ensure no RF field is detected.
  3. ISO Control register (0x01) → 0x32 (NFC-F at 212 kbps).
  4. Delay 1 ms
  5. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission with CRC direct command (0x11).
    3. TX Length Byte 1 and 2 (0x1D and 0x1E) registers.
    4. Write the response to the FIFO.

NOTE

For more details on the NFC-F protocol, see [2], [3], [6], [7] and [8].

peer_to_peer_212kbps_active_initiator_anti_collision_sloa192.gifFigure 12. Peer-to-Peer 212-kbps Active Initiator Anticollision

5.2 Passive Communication

The TRF7970A ISO Control register (0x01) sets the modulation of the transceiver RF field when it is in initiator mode and the bit rate at which to load modulate the initiator's field when it is in target mode. Unlike active communication, the target load modulates the initiator RF field instead of modulating its own field. Furthermore, the anticollision procedure is different for passive communication and active communication.

5.2.1 Initiator

Once the Initial RF Collision is completed and no RF field has been detected (as shown in Figure 11), the following registers must be modified before the anticollision. For more information, see Section 2).

  1. ISO Control register (0x01) → 0x32 (NFC-F at 212 kbps, receive with CRC).
  2. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission with CRC direct command (0x11).
    3. TX Length Byte 1 (0x1D) and TX Length Byte 2 (0x1E) registers.
    4. Write the response to the FIFO.

Step 2 must be used to send commands to the passive target.

5.2.2 Target

After receiving commands from the initiator, the transceiver must be modified when the anticollision process is started:

  1. ISO Control register (0x01) → 0x22 (NFC-F at 212 kbps, receive with CRC).
  2. Send packet:
    1. Reset FIFO (0x0F) direct command.
    2. Transmission with CRC direct command (0x11).
    3. TX Length Byte 1 and 2 (0x1D and 0x1E) registers.
    4. Write the response to the FIFO.

Step 2 must be used to send commands to the passive target.

 

Texas Instruments

© Copyright 1995-2025 Texas Instruments Incorporated. All rights reserved.
Submit documentation feedback | IMPORTANT NOTICE | Trademarks | Privacy policy | Cookie policy | Terms of use | Terms of sale