User manual

NXP Semiconductors
AN11480
Quick Start Up Guide for EXPLORE NFC working with Raspberry Pi
AN11480
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2013. All rights reserved.
Application note
COMPANY PUBLIC
Rev. 1.017 December 2013
279710
11 of 30
6. How does the Polling software work?
Imagine in a Hotel you got a key card for your room and want to check what card it is. Is
it contactless card? And if it is a contactless card, what type of card is it? Or if you got a
contactless public transport monthly pass. With the polling software you can get this
information immediately.
Another goal is to show the developer how to start a communication with different
contactless cards. Based on the software one can easily see the initialization flow that is
needed to be able writing or reading contents to or from cards.
So the basic idea behind the polling software is to identify the exact type of a contactless
card.
6.1 Functional principle
The main software is divided into three parts.
First it checks for command line arguments. After that is done, the software initializes the
hardware specific parts according to the chosen hardware.
The second step is to initialize some more hardware specific but common parts like the
SPI interface. If everything went fine, the polling procedure can start.
Third, the software begins to check if any supported NFC card is in the field. It begins
with the MIFARE cards, than the JIS X 6319-4 compatible cards and it checks if there is
a ISO/IEC 14443B card in the field.
The initialization of the required protocols before the detection can be started, and the
detection itself, is done in separate functions.
If any NFC card has been detected, the software stops looking for other cards and prints
out the type of the found card. For example: if the software detects an MIFARE card, it
does not look for JIS X 6319-4 compatible cards and ISO/IEC 14443B cards.
6.2 Card detection
The project can be split into four different card and tag detections. It can detect MIFARE
cards, FeliCa cards and ISO/IEC 14443B cards.
The function “DetectMifare()” is responsible to detect all MIFARE cards and determine
their type [15.].
The function “DetectFelica()” is responsible to detect all JIS X 6319-4 compatible cards.
The function “DetectTypB()” is responsible to detect all ISO/IEC 14443B cards.
6.3 Detecting Payment cards
The Polling project is also able to detect cards or tags and return their type. Additionally,
when a Payment card is detected, this project also tries to get the Payment System
Environment (PSE) and the Application Identifier (AID) of the card.
Three functions are used for the additional part. The function “PaymentCard” tries to get
the PSE and AID while the functions “Compare” and “Card_Scheme” help this function to
check whether the PSE and AID are valid or not.
The function “PaymentCard” sends a request to get access to the PSE. The PSE is a file
either with the name 1PAY.SYS.DDF01 or 2PAY.SYS.DDF01. With two possible names
there are two possible commands that can be sent. The arrays containing the request