没有合适的资源?快使用搜索试试~ 我知道了~
首页nfc controller interface 安卓技术指导
资源详情
资源评论
资源推荐

AN11690
NXP NCI Android Porting Guidelines
Rev. 1.6 — 8 October 2018
333216
Application note
COMPANY PUBLIC
Document information
Info
Content
Keywords
Android, NFC, NXP, NCI, PN7120, PN7150
Abstract
This note describes how to add support for a NXP NCI based NFC
Controller to an Android system

NXP Semiconductors
AN11690
NXP NCI Android Porting Guidelines
AN11690
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2018. All rights reserved.
Application note
COMPANY PUBLIC
Rev. 1.6 — 8 October 2018
333216
2 of 38
Contact information
For more information, please visit:
http://www.nxp.com
Revision history
Rev
Date
Description
1.6
20181008
Repositories moved back to GitHub
Added support for Android Pie (PN7150 only)
1.5
20180330
Repositories moved to CodeAurora
Added support for Android Oreo (PN7150 only)
1.4
20170530
Added description of the NFC Factory Test native application
1.3
20170512
• Added support for Android Nougat
• Added note about porting to other Android versions than referenced ones
• Fixed typo about kernel driver repository address
• Added information about sepolicy definition in the troubleshooting section
1.2
20160819
Added support for Android Marshmallow
1.1
20160525
Update for PN7150 support
1.0
20150602
First release

NXP Semiconductors
AN11690
NXP NCI Android Porting Guidelines
AN11690
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2018. All rights reserved.
Application note
COMPANY PUBLIC
Rev. 1.6 — 8 October 2018
333216
3 of 38
1. Introduction
This document provides guidelines for the integration of NXP NCI based NFC Controller
to an Android platform from software perspective.
It first explains how install the required kernel driver, then it describes step by step how to
adapt the Android Open Source Project sources from the NXP-NCI Android NFC
package delivery. Fig 1 shows the architecture of the Android NFC stack.
NXP NCI HAL
PN5xx I2C Driver
NXP NCI NFC Controller
Kernel API
Native libraries (C/C++)
Physical interface
Linux kernel drivers (I2C, GPIO…)
Other NCI HAL
NFC Controller Interface (libnfc-nci)
Java Native Interface (JNI)
Android NFC API
NFC service
NXP extension
NXP extension
Android app using NFC
App layer (Java)
JNI API
App framework (Java)
Linux kernel
NXP extension
Fig 1. Android NFC stack overview
• The pn5xx_I2c driver is the kernel module allowing to access NXP NCI based
NFC Controller hardware resource.
• The NXP NCI HAL module is the implementation of NXP NFC Controller’s
specific Hardware Abstraction Layer.
• The libnfc-nci is the native library providing NFC functionality for which extension
is added to support NXP proprietary features (e.g. support for MIFARE Classic).
• The JNI is a glue code between Java and Native classes. Extension exposes
related additional interface.
• The NFC service is the application framework module providing access to NFC
functionality. Extension is delivered to support NXP proprietary features.

NXP Semiconductors
AN11690
NXP NCI Android Porting Guidelines
AN11690
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2018. All rights reserved.
Application note
COMPANY PUBLIC
Rev. 1.6 — 8 October 2018
333216
4 of 38
2. Kernel driver
The NXP-NCI Android stack uses PN5xx I2C kernel mode driver to communicate with
the NXP NCI NFC Controller. It is available from the following repository:
https://github.com/NXPNFCLinux/nxp-pn5xx
.
2.1 Driver details
The PN5xx I2C driver offers communication to the NFC Controller connected over I2C
physical interface. This is insured through the device node named /dev/pn544. This low-
level driver is compatible with a broad range of NXP’s NFC Controllers (e.g. PN544).
2.2 Installation instructions
The following instructions assume the driver being installed under the drivers/misc kernel
source sub-folder. Below instructions may have to be adapted accordingly in case
another path is chosen for the driver installation.
2.2.1 Getting the driver
Clone the nxp-pn5xx repository into the kernel directory:
$ cd drivers/misc
$ git clone https://github.com/NXPNFCLinux/nxp-pn5xx.git
This will create the sub-folder nxp-pn5xx containing the following files:
• pn5xx_i2c.c: driver implementation
• pn5xx_i2c.h: driver interface definition
• README.md: repository comments
• Makefile: driver related makefile
• Kconfig: driver related config file
• LICENSE: driver licensing terms
• sample_devicetree.txt: example of device tree definition
2.2.2 Including the driver to the kernel
Include the driver to the compilation by adding below line to the heading makefile
(drivers/misc/Makefile).
obj-y += nxp-pn5xx/
Include the driver config by adding below line to the heading configuration file
(drivers/misc/Kconfig).
source "drivers/misc/nxp-pn5xx/Kconfig"

NXP Semiconductors
AN11690
NXP NCI Android Porting Guidelines
AN11690
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2018. All rights reserved.
Application note
COMPANY PUBLIC
Rev. 1.6 — 8 October 2018
333216
5 of 38
2.2.3 Creating the device node
Two methods are supported for the creation of the /dev/pn544 device node: device tree
and platform data. Any of the two methods can be used, but of course the I2C address
(0x28 in the below examples) and GPIO assignments must be adapted to the hardware
integration in the platform.
2.2.3.1 Device tree
Below is an example of definition to be added to the platform device tree file (.dts file
located for instance under arch/arm/boot/dts kernel sub-folder for ARM based platform).
&i2c{
status = "okay";
pn547: pn547@28 {
compatible = "nxp,pn547";
reg = <0x28>;
clock-frequency = <400000>;
interrupt-gpios = <&gpio2 17 0>;
enable-gpios = <&gpio4 21 0>;
};
};
2.2.3.2 Platform data
Below is an example of definition to be added to the platform definition file. The structure
pn544_i2c_platform_data being defined in the driver interface header file, pn5xx_i2c.h
must be included in the platform definition file, and pn5xx_i2c.h file must be copied to
include/linux kernel source sub-folder.
static struct pn544_i2c_platform_data nfc_pdata = {
.irq_gpio = GPIO_TO_PIN(1,29),
.ven_gpio = GPIO_TO_PIN(0,30),
.firm_gpio = GPIO_UNUSED
.clkreq_gpio = GPIO_UNUSED
};
static struct i2c_board_info __initdata nfc_board_info[] = {
{
I2C_BOARD_INFO("pn547", 0x28),
.platform_data = &nfc_pdata,
},
};
Then the declared nfc_board_info structure must be added to the platform using
dedicated procedure (platform specific).
剩余37页未读,继续阅读
















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0