pn532写入手机nfc,安卓4.4.2,PN532 NFC读写器和NFC卡模拟

I have developed a system that can read NFC tag using a reader with PN532 chip. It works ok. I can read Mifare Classic and Mifare Ultralight tag.

Now I'd like to use a Nexus Tablet with Android 4.4.2 to emulate a tag. I have no experience with android development but I think it is possible.

I have set NFC communication in the Nexus Tablet but I think I have to download or write some application to emulate a Tag and an NDEF communication.

What is the easiest way?

解决方案

That depends on what Nexus tablet you have:

Nexus 7 (first generation/2012 version): This device uses NXP's PN544 NFC controller. It seems that it's currently not possible to perform host-based card emulation with Android 4.4+ on these devices (see this question and my answer here).

Nexus 7 (second generation/2013 version) and Nexus 10: These devices use Broadcom's NFC controller. Therefore, you can use Android 4.4's HCE API to emulate a contactless smartcard.

With Android's HCE API you will emulate an ISO 14443-4 smartcard and you can only communicate using the application selection and APDU format defined in ISO 7816-4. You would first create and register a HCE service (see the API guide). Then you can process incoming APDUs using the service's processCommandApdu() method (see this answer).

If your reader-side application currently only processes MIFARE Classic and Ultralight, you would have to extend it to also communicate with ISO 14443-4/APDU-based smartcards. (Emulation of non-APDU based cards like MIFARE Classic and Ultralight is not possible on top of ANdroid's HCE API.) The PN532 will typically handle the bigger part of this for you, so once you discover such a smartcard (e.g. with InListPassiveTarget) it should automatically handle the ISO 14443-4 transport protocol and you can directly send APDU commands using the InDataExchange command.

If you want to exchange NDEF messages over HCE, once you have APDU-based communication up and running, you could implement the NFC Forum's Type 4 Tag Operation specification (get it from the NFC Forum's website) within the Android HCE service to emulate a Type 4 NDEF tag.

PN532是NXP最近推出的一款NFC芯片,支持读器模式和模式(需要芯片Smart MX),支持TypeA丶TypeB丶TypeC三个标准。该NFC模块PN532开发板特点: @ 内部带一个MCU51,支持命令方式,可以直接跟PC串埠连接成为一个RFID读器,简单方便,成本低,性能好。 @ 读器通过串口和电脑连接,上位机可以使用libnfc,libnfc是一个开源的软件,功能特别强大,实现了很多nfc的功能。 @ 电路板全部采用机器焊接,外观整齐漂亮,质量稳定可靠。 @ 绝对不会出现虚焊和短路。市面上一些采用手工焊接的PN532(QFN封装)电路板,由於QFN封装的原因经常发生虚焊和短路现象。 @ 电路板将PN532的所有引脚都引出来,方便二次开发评估,包括smartMX芯片的接口也引出来。 @ 电路板天线经过数学公式的计算,达到最佳的匹配效果,3.3v供电,最远的读距离可以达到7.5CM! NFC模块PN532开发板实物截图: NFC技术原理 @ 支持NFC的设备可以在操作或读写器模式下交换数据。 @ 在读写器模式下,启动NFC通信的设备,也称为NFC发起设备(主设备),在整个通信过程中提供射频场(RF-field)。 @ 它可以选择106kbps丶212kbps或424kbps其中一种传输速度,将数据发送到另一台设备。 @ 另一台设备称为NFC目标设备(从设备),不必产生射频场,而使用负载调制(load modulation)技术,即可相同的速度将数据传回发起设备。 @ 此通信机制与基於ISO14443A丶MIFARE和FeliCa的非接触式智能兼容,因此,NFC发起设备在读写器模式下,可以用相同的连接和初始化过程检测非接触式智能NFC目标设备,并与之建立联系。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值