Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
October 2016
Agenda
1
Agenda
2
Our support for NFC
Today’s session
3
INTRODUCTION TO THE
NFC READER LIBRARY
4
NFC Reader Library
Everything you need to create your own software stack
and application for a contactless reader
• Modular
• Multi-layered
• ANSI-C language
• Portable to multiple
design environments
and platforms
• Free download
Faster development: Save time and effort by using the APIs and the rich
set of sample applications for all the most common functions.
Simpler certification: Get ready for certification with test applications for
EMVCO L1, NFC Forum and ISO/IEC10373-6 PICC/PCD
6
NFC Reader Library
The same software stack for
PN512, CLRC663, PN5180 and PN7462 solutions
SW support for NFC frontend solutions
OM25180FDK
CLEV663B
PNEV512B
7
NFC Reader Library
The same software stack for
PN512, CLRC663, PN5180 and PN7462 solutions
SW support for NFC controllers with customizable firmware
OM27462CDK
8
NFC Reader Library
Support for multiple platforms
*Available soon
9
NFC Reader Library
Release contents
10
NFC Reader Library
Development environment
11
NFC Reader Library
Where to get it
12
NFC READER LIBRARY
ARCHITECTURE
13
NFC Reader Library
Release contents
14
NFC Reader Library
Architecture
• Each layer:
− Consists of different components, having a
generic interface and specific implementation
− Is independent from the other layers
− Is used as an entry point for the immediate
upper layer
15
NFC Reader Library
Common Layer
Key handling component for storing crypto keys used in
the authentication and encryption operations.
Component enabling
extended logging
16
NFC Reader Library
Common Layer
17
NFC Reader Library
Bus Abstraction Layer (BAL)
BAL layer implement the interface between host
MCU and the NFC reader IC
18
NFC Reader Library
Hardware Abstraction Layer (HAL)
19
NFC Reader Library
Protocol Abstraction Layer (PAL)
PAL components contain hardware-independent PAL implements communication modes and data
implementations of contactless protocols exchange regarding the contactless protocol.
20
NFC Reader Library
Application layer
AL components support:
- MIFARE Classic - ICODE SLI
- MIFARE Ultralight family - ISOIEC15693 commands
- FeliCa (partly) - ISO/IEC18000-3M3 commands
- NFC Forum Tag operations - Jewel /Topaz
(T1T, T2T, T3T, T4T and T5T)
21
NFC Reader Library
Activity layer
22
NFC Reader Library
HCE and P2P layers
23
NFC Reader Library
Simplified API
Three profiles:
• NFC Forum channel: Transfer of NDEF messages
• EMVCo channel: Transfer of APDUs according to EMVCO L1 spec
• ISO channel: Raw data transfer
24
NFC Reader Library
Demo apps and reference applications
SW examples illustrating all operations and commands SW examples illustrating the use of
required in contactless applications such as: the Simplified API for:
• Reading / writing data to cards, • EMVCo channel profile
• data exchange with other NFC devices • ISO channel profile
• NFC Reader ICs emulating cards
25
USING THE NFC READER LIBRARY:
BUILDING THE SW STACK
26
Using the NFC Reader Library
Building the SW stack User application
initialization concept
NFC Reader Library
• Each layer generates a context Protocol Abstraction Layer (PAL) Context
data which is used as an entry
point for the immediate upper
layer. Hardware Abstraction Layer (HAL) Context
27
Using the NFC Reader Library
Building the SW stack (Example)
Which NFC modes do we need
to support? • The application requirements define
which modules need to be enabled.
28
Using the NFC Reader Library
Building the SW stack (Example II)
5. Initialize the card command set
(e.g. MIFARE Classic module)
29
Using the NFC Reader Library
Building the SW stack (Example III)
1. Host interface initialization generates a data NFC
context used to initialize and configure the upper MIFARE AL Discovery
Classic Loop activity
layer (HAL)
phhalHw_Rc663_Init(…, void *pBalDataParams, …)
3 Context
components
phpalMifare_Sw_Init(…, void *pHalDataParams,…) 2 Context Context Context
30
Using the NFC Reader Library
Building the SW stack (Example IV) - Project build setup (ph_NxpBuild.h)
#define NXPBUILD__PHAC_DISCLOOP_SW • The build setup and functionality is
#define NXPBUILD__PHAL_MFC
set in the file:
../intfs/ph_NxpBuild.h.
#define NXPBUILD__PHPAL_MIFARE
• This file defines the modules to be
#define NXPBUILD__PHPAL_I14443P3A included into the build setup or to be
excluded from the build setup .
32
Using the NFC Reader Library
Detection Detection
Discovery loop Detection
NFC active
Type A Type B
Detection
Type F
@424 Detection
Type F
• It is a routine that sequentially sets the reader IC in @212
33
Using the NFC Reader Library
Discovery loop – Configuration settings
Detection Detection Detection
Detection Type A Type B Type F
@424 Detection
NFC active
Type F
@212 phacDiscLoop_SetConfig(…,
Detection PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG)
ISO15693
POLLING
MODE Detection /** Configure technologies to be detected in passive poll mode */
ISO18000-P3M3
#PHAC_DISCLOOP_POS_BIT_MASK_A -> Detect Type A.\n
#PHAC_DISCLOOP_POS_BIT_MASK_B -> Detect Type B.\n
#PHAC_DISCLOOP_POS_BIT_MASK_F212 -> Detect Type FELICA @ 212K
#PHAC_DISCLOOP_POS_BIT_MASK_F424 -> Detect Type FELICA @ 424K
#PHAC_DISCLOOP_POS_BIT_MASK_V -> Detect Type V / ISO 15693.\n
#PHAC_DISCLOOP_POS_BIT_MASK_18000P3M3 -> Detect ISO 18000p3m3
PAUSE
phase
For scanning just Type A cards:
phacDiscLoop_SetConfig(…,
LISTEN PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG,
MODE PHAC_DISCLOOP_POS_BIT_MASK_A)
PAUSE
phase
LISTEN
MODE
LISTEN
MODE
Detection Detection
ISO15693 ISO15693
POLLING POLLING
MODE Detection MODE Detection
ISO18000-P3M3 ISO18000-P3M3
PAUSE PAUSE
phase phase
LISTEN LISTEN
MODE MODE
phacDiscLoop_Run(pDataParams, phacDiscLoop_Run(pDataParams,
PHAC_DISCLOOP_ENTRY_POINT_POLL); PHAC_DISCLOOP_ENTRY_POINT_LISTEN
);
37
Using the NFC Reader Library
Discovery loop – Find detected technologies
• Get information about the detected NFC tags or • Checking whether one particular NFC tag or NFC
NFC devices. device has been detected can be done by using
phacDiscLoop_GetConfig(
the defined bitmasks
pDataParams, PHAC_DISCLOOP_POS_BIT_MASK_A
PHAC_DISCLOOP_POS_BIT_MASK_B
PHAC_DISCLOOP_CONFIG_TECH_DETECTED,
PHAC_DISCLOOP_POS_BIT_MASK_F212
&wTagsDetected); PHAC_DISCLOOP_POS_BIT_MASK_F424
PHAC_DISCLOOP_POS_BIT_MASK_V
PHAC_DISCLOOP_POS_BIT_MASK_18000P3M3
• Macro to check that a Type A tag was detected PHAC_DISCLOOP_ACT_POS_BIT_MASK_106
PHAC_DISCLOOP_ACT_POS_BIT_MASK_212
PHAC_DISCLOOP_CHECK_ANDMASK( PHAC_DISCLOOP_ACT_POS_BIT_MASK_424
wTagsDetected, PHAC_DISCLOOP_POS_BIT_MASK_A)
38
USING THE NFC READER LIBRARY:
SIMPLIFIED API
39
Simplified API
Write NFC applications using as little code as possible
40
Simplified API
Write NFC applications using as less code as possible
Profiles
1 Initialize the NFC Reader Library phNfcLib_Init();
phNfcLib_SetConfig_Value(
2 Set the profile (ISO, EMVCo or NFC Forum) PH_NFCLIB_CONFIG_ACTIVATION_PROFILE,
PH_NFCLIB_ACTIVATION_PROFILE_ISO);
NFC Forum
3 Activate the card or peer phNfcLib_Activate(wTechnologyMask, &PeerInfo,
NULL);
EMVCo
41
SOFTWARE EXAMPLES
42
NFC Reader Library
Release contents
43
Example 1: BasicDiscoveryLoop
Initializes BAL&HAL components
phPlatform_Init()
Functionality
• Scans for NFC tags and NFC devices and Initializes PAL/AL and other components
phApp_RdLibInit()
displays the detected device information (such
as UID, SAK, Product Type for MIFARE cards)
Get poll config
phacDiscLoop_GetConfig()
• If multiple technologies are detected, the
example will select the first detected technology Configure poll state and LPCD (if active)
to resolve. phacDiscLoop_SetConfig()
44
Example 2: AdvancedDiscoveryLoop
Initializes BAL&HAL components
phPlatform_Init()
Functionality
• Scans for NFC tags and NFC devices and Initializes PAL/AL and other components
phApp_RdLibInit()
displays the detected device information (such
as UID, SAK, Product Type for MIFARE cards) Load profile
LoadProfile(PHAC_DISCLOOP_PROFILE_NFC)
to resolve.
Configure poll state and LPCD (if active)
phacDiscLoop_SetConfig()
45
Example 3: NFCForum
Initializes BAL&HAL components
phPlatform_Init()
Functionality
• Scans for NFC tags and NFC devices and Initializes PAL/AL and other components
phApp_RdLibInit()
displays the detected device information (such
as UID, SAK, Product Type for MIFARE cards) Enable SNEP Client or Server (if defined)
Benefits
Start Discovery loop
phacDiscLoop_Run()
• Shows how to implement the P2P mode and
reader function to detect Type A, Type B, Type
Multiple
F, Type V and ISO18000-3M3 tags. detection
Display info
47
Example 5: ISO/IEC15693
Initializes BAL&HAL components
phPlatform_Init()
Functionality
• Detects an ISO15693-compliant card and Initializes PAL/AL and other components
phApp_RdLibInit()
displays tag type and tag UID information.
Configures Library for type V cards
• Performs a block read and block write phApp_Init
• Shows the discovery loop configuration for Detect and actívate card
48
Example 6: EMVCo Loopback
Initializes BAL&HAL components
phPlatform_Init()
Functionality
Initializes PAL/AL and other components
• Implements a loopback application which is phApp_RdLibInit()
• It can be tested with payment cards Configure Discovery loop for Poll Mode
phacDiscLoop_SetConfig()
certification
Get parameters of detected techonlogy
phacDiscLoop_GetConfig()
49
Example 7: EMVCo Polling
Initializes BAL&HAL components
phPlatform_Init()
Functionality
Initializes PAL/AL and other components
• Detects an EMVCo payment cards. phApp_RdLibInit()
• It displays the response of the detected EMVCo Load EMVCo default settings
card after the select PPSE command. LoadEmvcoSettings()
50
Example 8: HCE T4T
Initializes BAL&HAL components
Functionality phPlatform_Init()
• Implements a Type 4-A tag card emulation with Initializes PAL/AL and other components
phApp_RdLibInit()
a default NDEF message stored on its memory.
• It supports all specified commands such as Configure CE parameters and semaphores
phApp_Initialize()
Select, ReadBinary, UpdateBinary, etc
• It allows both reading and writing and NDEF Start Discovery loop in listen mode
phacDiscLoop_Run()
messages into the emulated card.
Detect card
Benefits
Activate ISO 14443p4mC
• Shows how to emulate a Type 4 tag and to phpalI14443p4mC_Activate()
51
Example 9: NTAG I2C
Initializes BAL&HAL components
phPlatform_Init()
Functionality
• Detects an NTAG I2C tag and displays Initializes PAL/AL and other components
phApp_RdLibInit()
information like UID, ATQA, SAK and version.
Configure Discovery loop for poll mode
• Performs a SECTOR_SELECT, page READ phacDiscLoop_SetConfig()
Detect card
Benefits
Check type A and type 2 card
• Shows the use of commands to communicate Select and read from page 5 to 8
phalMful_FastRead()
with NTAG I2C product
Select and write from page 5 to 8
phalMful_Write()
52
Example 10: Simplified API ISO
Functionality
• Implements sample applications for MIFARE
Classic, MIFARE Ultralight, MIFARE DESFire, Initializes Reader Library components
phNfcLib_Init()
Type B, ISO/IEC15693 and ISO/IEC18000-3M3
using the Simplified API with an ISO profile. Configure ISO profile
phNfcLib_SetConfig_Value()
Activate card
phNfcLib_Activate()
53
Example 11: Simplified API EMVCo
Functionality
• Implements a loopback application using the
Initializes Reader Library components
Simplified API to perform EMVCo 2.5 (L1) phNfcLib_Init()
Activate card
phNfcLib_Activate()
Benefits
Transmit PPSE Select APDU
phNfcLib_Transmit()
• Shows how to use the Simplified API with an
EMVCo profile. Receive PPSE Select APDU response
phNfcLib_Receive()
• It can be used to conduct EMVCo Level 1 PCD
Perform EMVCo loopback
certification
Deselect card
phNfcLib_Deactivate()
54
DOCUMENTATION
55
NFC Reader Library
Release contents
56
NFC Reader Library reference API documentation
• The NFC Reader Library
reference API is also delivered in
HTML format.
57
NFC Reader Library reference API documentation
58
TO SUM UP
59
NFC Reader Library
In a nutshell
• It is the SW support for NXP’s NFC frontends
and NFC controllers with customizable
firmware
• Complemented with software examples Latest version and information available at:
illustrating typical use cases. http://www.nxp.com/pages/:NFC-READER-LIBRARY
60
Software development in Android and iOS MIFARE applications
Embedded software for MCUs End-to-end systems, readers and card-related designs
JCOP, Java Card operating Systems EMVco applications
Hardware design and development Readers, cards, design for test compliancy (including PCI)
Digital, analog, sensor acquisition, power management Secure Element management
Wireless communications WiFi, ZigBee, Bluetooth, BLE GlobalPlatform compliant backend solutions
Contactless antenna RF design, evaluation and testing Secure services provisioning OTA, TSM services
MobileKnowledge
We help companies leverage the Roc Boronat 117, P3M3
08018 Barcelona
61
Design and implement NFC applications
Session 4: NFC Reader Library- SW support for NFC
frontends and NFC controllers w. custom. FW solutions
Jordi Jofre (Speaker)
Angela Gemio (Host)
Check your email for material download and on-demand video addresses
62