HOW TO INTEGRATE NFC FRONTENDS IN LINUX WEBINAR SERIES: NFC SOFTWARE INTEGRATION JORDI JOFRE NFC READERS NFC EVERYWHERE 14/09/2017 PUBLIC
Agenda NFC software integration webinar series Session I, 14th September How to integrate NFC frontends in Linux. Session II, 28th September How to integrate NFC controllers in Linux. Session III, 11th October How to port the NFC Reader Library to K64F. 1
Agenda NFC software integration webinar series Session I, 14th September How to integrate NFC frontends in Linux. ► NFC readers software development design-in support. ► NFC Frontend concept. ► Linux OS architecture & NFC Reader Library integration in Linux. ► Host interface latency analysis in Linux. ► Wrap up & Q&A. 2
NFC readers software development design-in support 3
NXP’s software development support NFC implementation process Design files for NFC Reader Library development kits Sample code App notes Online training on SW NFC cockpit integration & tutorials You can re-use design of NXP development boards and sample code examples to speed up your SW development tasks. 4
NXP software support for integration into any platform Connected NFC tags Bare metal Connected NFC tag NTAG I 2 C plus NFC frontends RTOS NFC frontend PN5180 Linux OS NFC controllers with integrated FW NFC controller with integrated firmware PN71xx Software integration Other OS NFC controllers with customizable FW NFC controller with application PN7462 This session covers topics related to NFC frontend software integration in Linux 5
NFC Frontend concept 6
NFC frontend offers a host interface and a contactless interface RF interface Host interface • An NFC frontend is an RF transceiver • This register interface is a low level access enabling the contactless communication. to the contactless interface providing full access to this IP. • It deals with the signal modulation and • This could be a direct CLIF-mapped handles the data transmission through the RF Host interface RF interface interface. interface (CLRC663, PN512) or a software emulated register interface (PN5180). NFC frontend • The NFC frontend needs to be selected • The host controller uses the register according to application requirements: • RF performance access to the contactless interface: • RF protocols • to configure RF framing and • NFC modes of operation signaling . • Host interfaces • to finally transfer the RF digital • Power consumption protocol based blocks to/from a • Device to interact with counterpart. • Others… NFC frontends expose a ‘register interface’ towards the host controller through the host interface 7
NFC frontend is controlled by the external host controller SW Host controller The host controller drives and controls the NFC • Contains the software implementing the frontend according to register settings configuration application logic • The RF digital protocols are implemented Host controller on the host controller Host interface Register configs RF communication RF interface NFC Matching • The host controller platform needs to be application NFC frontend selected according to system requirements: Linux OS • Memory requirements • Clock frequency • MCU architecture HW platform • Host interfaces • Power consumption • GPIOs and other peripherals TODAY : NFC application runs on Linux OS system The NFC Reader Library can be installed on a generic GNU/Linux platform* *Support on Raspberry Pi platform provided as reference. 8
Linux OS architecture 9
Host controller SW: Linux OS architecture - User space User Space • Applications and user programs run in User App 1 App 2 App 3 App n Space (non-privileged mode). User Space System Libraries • User Space code has no ability to access Host controller DRM GNU C Other libs hardware or drivers directly. Library Library Host interface • Due to the protection afforded by this sort of Linux OS isolation, crashes in user mode are always stack recoverable. Kernel Space • User space process occupies its own virtual HW platform address space 10
Host controller SW: Linux OS architecture - Kernel space Kernel Space • The kernel connects the application software to the hardware platform. User Space • The executing code has complete and Host controller unrestricted access to the underlying Host interface hardware. Linux OS • Kernel mode is generally reserved for the stack lowest-level, most trusted functions of the Generic Kernel operating system Kernel Space HW platform Memory Virtual File Network Process • Kernel Mode "prevents" User Mode scheduler manager System Stack applications from damaging the system or its features Crashes in kernel mode are Hardware Dependent Kernel catastrophic. Display SPI driver I2C driver USB driver Driver • Kernel space runs on the single address space. 11
Host controller SW: Linux OS architecture – System call interface System call interface • Provides the means to perform function calls from user space into the kernel space User Space • Code running in user mode must delegate to Host controller system call APIs to access hardware or Host interface memory. Syscall Interface Linux OS • Most operations interacting with the system stack Syscall Dispatcher require permissions unavailable to a user level process (e.g. Input / Output operations) Kernel Space HW platform • Input/output (I/O) is any program, operation or device that transfers data to or from the CPU and to or from a peripheral device 12
Integrating the NFC Reader Library in Linux 13
NFC Reader Library: The SW stack for developing NFC applications NFC Reader Library SW integration • The NFC Reader Library provides an API, App 1 App 2 App 3 NFC app including everything you need to deploy for User Space NFC applications: System Libraries • Host platform drivers Host controller DRM NFC Reader GNU C • RF digital protocols Library library Library Host interface • Full feature set according to NFC Forum • NXP NFC frontends hardware drivers Linux OS • MIFARE cards and NFC Forum tag stack operation Generic Kernel Kernel Space • The NFC Reader Library runs within the User HW platform Memory Virtual File Network Process Space. scheduler manager System Stack • The customer NFC app is built on top of the Hardware Dependent Kernel NFC Reader Library, taking advantage of the Display SPI driver I2C driver USB driver offered API Driver The NFC Reader Library is the NXP software stack to develop NFC applications and there is an existing version for Linux OS architecture! 14
NFC Reader Library support for multiple products and platforms NFC Reader Library Supported products:* • CLRC663 plus • PN5180 • PN7462AU Supported dev boards:* • CLEV6630B • PNEV5180B • PNEV7462B Supported platforms:* • LPC1769 • FRDM-K82F • Raspberry Pi Model 3 Linux • … and portable to other MCUs and Info and more information: www.nxp.com/pages/:NFC-READER-LIBRARY platforms . The NFC Reader Library is everything you need to create your 15 own software stack and application for a contactless reader
NFC Reader Library support for Linux 11 software examples available to be tested and re-used in Linux AL and PAL layers are hardware and platform independent , so they can be used in Linux as they are without any adaptation HAL is platform independent , so NXP NFC readers can be used in Linux as it is without any adaptation The software examples can be imported and run in Raspberry Pi & Linux without any adaptation. Support for other platforms requires adaptations in OSAL and DAL. 16
NFC Reader Library - building the SW stack for Linux Comment / uncomment the specific macro defined Macros used in OSAL to enable Linux OS for including / excluding each SW component. E.g. #ifdef PHOSAL_LINUX #define NXPBUILD__PHPAL_I14443P3A_SW # include “../ src/Linux/phOsal_Linux.h ” #define NXPBUILD__PHPAL_I14443P3B_SW #define NXPBUILD__PHPAL_I14443P4A_SW #define NXPBUILD__PHPAL_I14443P4_SW #define NXPBUILD__PHPAL_MIFARE_SW #define NXPBUILD__PHPAL_FELICA_SW Macros used in DAL to enable Raspberry Pi platform for PN5180 and CLRC663 #ifdef PHDRIVER_PIPN5180_BOARD # include <Board_PiPn5180.h> #endif #ifdef PHDRIVER_PIRC663_BOARD # include <Board_PiRc663.h> #endif 17
Host interface access on Linux systems 18
Linux based application: System call interface function call App 1 App 2 App 3 NFC app User Space System Libraries A system call leads to a so-called system call Host controller DRM NFC Reader GNU C Library library context switch. This context switch Library changes the execution context from Syscall Interface user space to kernel space Linux OS stack Syscall Dispatcher Generic Kernel Kernel Space HW platform Memory Virtual File Network Process scheduler manager System Stack Host interface Hardware Dependent Kernel NFC Display I2C driver SPI driver USB driver Driver frontend The NFC application needs to switch from User Space to Kernel Space for every SPI interface access 19
Recommend
More recommend