how to integrate nfc controllers in linux
play

HOW TO INTEGRATE NFC CONTROLLERS IN LINUX WEBINAR SERIES: NFC - PowerPoint PPT Presentation

HOW TO INTEGRATE NFC CONTROLLERS IN LINUX WEBINAR SERIES: NFC SOFTWARE INTEGRATION JORDI JOFRE NFC READERS NFC EVERYWHERE 28/09/2017 PUBLIC Agenda NFC software integration webinar series Session I, 14th September How to integrate NFC


  1. HOW TO INTEGRATE NFC CONTROLLERS IN LINUX WEBINAR SERIES: NFC SOFTWARE INTEGRATION JORDI JOFRE NFC READERS NFC EVERYWHERE 28/09/2017 PUBLIC

  2. 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

  3. Agenda NFC software integration webinar series Session III, 11th October How to integrate NFC controllers in Linux. ► Recap about last session ► PN7150 NFC controller family ► PN7150 NFC controller concept ► NFC software libraries available for Linux ► Integration in Linux using the Linux libnfc-nci SW stack ► PN7462 NFC controller family ► PN7462 NFC controller concept ► PN7462 NFC integration in Linux ► Wrap up and Q&A 2

  4. Recap about last session 3

  5. NFC frontends software integration in Linux • NFC Frontends expose a ‘register interface’ towards the host controller through the host interface • The NFC Reader Library can be installed on a generic GNU/Linux platform. • Increase CPU/SPI clock as much as the MCU can process. • Reduce SPI / host interface interactions as much as • High latency: Access the host interface (I 2 C, SPI, possible: Linux driver is optimized for few long UART drivers) in Linux Kernel space is slow. Solutions transactions rather than lots of short ones • High CPU load: There is a lot of code involved just to • Move NFC Reader Library BAL module to Kernel write one register in Linux context switching. space. 4

  6. PN7150 NFC controller family concept 5

  7. PN7150 NFC controller family host and contactless interfaces RF interface Host interface • Full NFC Forum compliancy with small form • PN7150 is connected to the host device factor antenna. through an I 2 C physical interface. • Ultra-low power consumption in polling loop • PN7150 logical interface (API) is based on Host interface mode allows without impacting the user the NCI NFC Forum standard. RF interface NFC controller experience. with embedded • It supports additional , NXP proprietary firmware • Embedded NFC firmware providing all NFC extensions specific to the PN7150 chip. (PN7150) protocols as pre-integrated feature • In few NCI commands, host SW can • Load modulation schemes: Active & Passive configure the PN7150 to notify for card or peer detection and start data exchange. PN7150 NFC controller family are integrated solutions combining an NFC frontend together with an MCU 6

  8. PN7150 NFC controller family are managed by NCI commands PN7150 NFC controller embeds an ARM Cortex-M0 microcontroller core loaded with integrated firmware Host controller supporting the NCI 1.0 host communication. • SW implementation is required for both entities, the NFC FW for the controller side, and the NCI driver from the device host. Host controller NFC controller Host interface with integrated RF interface • NCI defines a standard communication firmware NFC Matching channel between the NFC controller and the application NCI commands RF communication host device. ARM NCI driver Cortex-M0 core • It provides manufacturers with a standard Linux OS interface they can use for whatever kind of NFC-enabled device they build. TODAY : NFC application runs on Linux OS system There is NCI driver support for Linux, Android, Windows IoT, RTOS and bare metal systems. 7

  9. PN7150 NFC controller family architecture NFC controller with integrated FW • Implements NCI 1.0 compliant protocol. • Runs the NFC stack and RF protocols. Key benefits 32-bit Cortex-M0 • Critical timing constraints on host are power-efficient handled by the embedded FW. 20MHz ARM Cortex-M0 • Host interactions are reduced since some functionalities are handled ROM with NFC firmware autonomously by the embedded FW. 8

  10. PN7150 NFC software integration in Linux NFC software libraries available for Linux 9

  11. NFC software libraries available for Linux • MUSCLE is a project to develop a set of compliant drivers, API's, Library focused on smartcard and a resource manager for various smart cards and readers for MUSCLE integration into computing environment the GNU environment. PC/SC Lite rather than an NFC SW stack • Middleware to access a smart card using the SCard API. • Open source implementation of PC/SC (Microsoft OS). Not reusable for PN7150, NCI • Implements NFC Forum specifications for data exchange with NFC support is not included devices and tags. • Python module for NFC. Not all NFC functionalities • USB and UART devices support. nfcpy implemented (e.g. Card • EUPL licensed project and available at GitHub. emulation limited to Type 3 tags) 10

  12. NFC software libraries available for Linux (II) • Academic LGPL licensed project. • Written in C. • USB and UART devices support. Not reusable for PN7150 since NCI support is not included • Open source and community supported. • Support for various operating systems ( Linux, Mac OS, Windows). Libnfc • No ROM memory access on Linux. (From NFC Tools) • Maintained by Intel open source community. NXP originally contributed to • Aims to be HW independent (NXP, TI, Inside Secure, etc). Supports Linux this SW stack. Support has HCI, NCI and USB hardware. stopped for their NCI-based NFC • GPLv2 licensed. NFC controllers. • Split between kernel and user spaces. 11

  13. NFC software libraries available for Linux (III) • NDEF tag support • MIFARE Classic tag support Optimized in terms of • P2P, LLCP, SNEP interoperability with mobile • WiFi & BT handover devices • Raw tag command support Linux • Proprietary NCI command support Libnfc-nci • Host Card Emulation support Works together with the PN5xx I2C driver, which is compatible and offers communication with NXP NFC controllers through an I 2 C interface It is the native library providing NFC Derived from the available functionality for the extension added to and proven Android stack support NXP proprietary features. Linux Libnfc-nci is the best choice for integrating PN7150 NFC controllers in Linux 12

  14. PN7150 NFC software intregration in Linux Linux libnfc-nci stack 13

  15. Linux libnfc-nci stack mapping in Linux architecture Linux libnfc-nci details App 1 App 2 App 3 NFC app User Space Linux libnfc-nci stack consists of a library System Libraries running in User space and implement NFC Host controller Linux libnfc-nci GNU C DRM features (NCI, NDEF, LLCP and SNEP stack Library Library Host interface protocols, Tag Operations, Host Card Emulation…) Syscall Interface Linux OS stack Syscall Dispatcher Low level access to PN7150 HW Generic Kernel PN5xx_I2c kernel mode driver can be Kernel Space HW platform used to communicate with the Memory Virtual File Network Process scheduler manager System Stack PN7150 NFC controller Host interface Hardware Dependent Kernel PN7150 NFC Display I2C PN5xx_I2C USB driver Controller Driver driver driver NCI commands PN7150 FW autonomously handles part of the NFC activity so it requires much less interaction on the I 2 C interface than NFC frontends, reducing context switching. 14

  16. Linux libnfc-nci stack architecture in detail Libnfc-nci library Interface Layer: exposes the library API to the user application. Libnfc-nci Core : implements the NFC functionality (NCI, NDEF, LLCP and SNEP protocols, tag operations, Host Card Emulation…) Hardware Abstraction Layer: provides connection to the kernel driver as well as basic functionalities such as self-test or firmware update. Linux Libnfc-nci repository permanently updated and maintained by NXP $ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git *For alternatives to PN5xx_I2C kernel driver, check AN11769 15

  17. Integrating the Linux-libnfc-nci stack into a Linux system 16

  18. Integrating the Linux libnfc-nci stack into a Linux system App 1 App 2 App 3 NFC app User Space System Libraries Step 2: Host controller Linux libnfc-nci Install the Linux libnfc-nci in GNU C DRM stack Library Library Host interface user mode. Syscall Interface Linux OS stack Syscall Dispatcher Step 1: Generic Kernel Install the PN51xx I 2 C driver as Kernel Space HW platform Memory Virtual File Network Process part of the kernel. scheduler manager System Stack Host interface Hardware Dependent Kernel PN7150 NFC Display I2C PN5xx_I2C USB driver Controller Driver driver driver Integration steps are described in the AN11769 – PN71xx Linux Software Stack Integration Guidelines in detail. 17

  19. Step 1: Installing PN5xx I2C driver • Steps to install the PN5xx I2C driver: Download the driver source code 1. $ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git Include the driver to the kernel 2. Obj-y +=nxp-pn5xx/ Source “drivers/ misc/nxp-pn5xx/Kconfig ” Create the device node 3. &i2c{ status = "okay"; pn547: pn547@28 { compatible = "nxp,pn547"; reg = <0x28>; clock-frequency = <400000>; interrupt-gpios = <&gpio2 17 0>; enable-gpios = <&gpio4 21 0>; }; }; Live demo with RaspberryPi: http://youtu.be/TCgCRi-tKxM Build the driver 4. Change access to device node 5. ACTION==“add”, KERNEL==“pn544”, MODE=“066” 18

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend