Personal tools

How to interface NXP PN7120 NFC reader module with the VisionSOM-6ULL

From SomLabs Wiki

Jump to: navigation, search

How to interface NXP PN7120 NFC reader module with the VisionSOM-6ULL


Description

Two example applications implementing different NFC use cases allow:

  • reading tags,
  • exchanging NDEF messages with a smartphone (P2P mode).

Theory of operation

NFC (Near-Field Communications) is a contactless interface enabling power and bi-directional data transfer, based on inductive coupling between two antennas.

Accessing a passive tag (left) and P2P mode

Two devices are always involved in NFC communication: an initiator and a target. The initiator must always be active, i.e. able to power the antenna. The target can be either active or passive. A passive target is powered by energy harvested by the antenna, and uses the antenna to modulate the existing field. Virtually all tags are passive targets.

NDEF (NFC Data Exchange Format) is used to carry messages via the NFC interface. It is supported by most consumer devices, including NFC-enabled Android smartphones. An NDEF message consists of one or more records. Standard record types are defined for many common payloads:

  • Text
  • Phone number
  • E-mail address
  • Geographical location
  • WiFi network credentials
  • MIME types
  • URIs


Application-specific record types can be defined by specifying new URI schemes or MIME types.

Prerequisites

This tutorial is based on a pre-prepared image for VisionSOM-6ULL module. The image is available here: SoMLabs-VisionSOM-6ULL-training-02-2018-sdcard-2gb.zip.

Then you need to write the image file to microSD card. More information you can find in manuals: How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Linux or How to prepare SD Card with Debian 9.2 for VisionSOM-6ULL on Windows. Please remember to use a proper image file: SoMLabs-VisionSOM-6ULL-training-02-2018-sdcard-2gb.zip.

Hardware set-up

Do not connect the shield to the Arduino-style connector on VisionCB. The connector on VisionCB has a 5V supply and uses 5V logic. The shield accepts only 3.3V.


Connect the PN7120 NFC Reader Module to the VisionCB according to the photo below:

NFC Reader Module interfacing.png


Reading tags

This application supports NDEF-formatted MIFARE Ultralite tags. It reads text records and prints them to the console.

To build and run the example:

root@localhost:~# cd ~/libnfc-nci-demos/read_ntag
root@localhost:~/libnfc-nci-demos/read_ntag# make
root@localhost:~/libnfc-nci-demos/read_ntag# ./read_ntag

If a new tag with text content will be placed near the antenna, a text record will be displayed in the console.

Exchanging NDEF messages with a smartphone (P2P mode)

P2P mode allows two active devices to exchange NDEF messages. Run the following commands in the Linux console:

root@localhost:~# cd ~/libnfc-nci-demos/ndef_p2p
root@localhost:~/libnfc-nci-demos/card_emu# make
root@localhost:~/libnfc-nci-demos/card_emu# ./ndef_p2p "Hello!"

Enable NFC in your smartphone: Settings → More → NFC

Place your smartphone close to the on-board NFC antenna. A dialog like in the photo below should pop up with the message supplied in the command-line argument.

NFC Received Screen.png
NXP Partner ST Partner Renesas Partner