在我们的项目中,我们试图在NFC读卡器ACS ACR122U中模拟ISO14443-3 PICC,并使用NFC手机(三星S3或S4)读取该卡。在S4的情况下,我们可以成功地与模拟卡通信,但是在S3的情况下,没有NFC事件。
我们注意到来自Android(logcat)的所有命令/响应和日志,这表明S3无法激活LLCP通信。我发布了所有数据,请帮助我们解决问题。
对ACR122u的命令/响应(读卡器中的PN532控制器):
COMMAND:FF0000002DD48C0400000000002001FE0FBBBAA6C9890000000000000000FFFF01FE0FBBBAA6C98900000647666D01011000
RESPONSE:D58D08E080
COMMAND:FF00000002D486
RESPONSE:D5870000A4040007D276000085010100
COMMAND:FF00000004D48E6A82
RESPONSE:D58F00
COMMAND:FF00000002D486
RESPONSE:D5870000A4040007D2760000850100
COMMAND:FF00000004D48E6A82
RESPONSE:D58F00
COMMAND:FF00000002D486
RESPONSE:D5870000A4040C05A00000000100 (Data we want to send to emulated card from NFC phone)
响应D58D08E080
表示读卡器模拟为:
现在,当我们将S4放在阅读器上时,我们有以下日志:
02-10 10:23:13.711: I/BrcmNci(3355): --
02-10 10:23:13.711: I/BrcmNci(3355): TX: Type 4 Tag Command (13 bytes)
02-10 10:23:13.711: I/BrcmNci(3355): CLA:0x00
02-10 10:23:13.711: I/BrcmNci(3355): INS:0xA4(Select)
02-10 10:23:13.711: I/BrcmNci(3355): P1:0x04(Name)
02-10 10:23:13.711: I/BrcmNci(3355): P2:0x00(First or Only)
02-10 10:23:13.711: I/BrcmNci(3355): Lc:0x07(7)
02-10 10:23:13.711: I/BrcmNci(3355): Data(7 bytes)
02-10 10:23:13.711: E/AudioResampler(2497): Unsupported sample format, 1 bits, 2 channels
02-10 10:23:13.716: I/BrcmNci(3355): 00 : d2 76 00 00 85 01 01
02-10 10:23:13.716: I/BrcmNci(3355): Le:0x00(0)
02-10 10:23:13.716: I/BrcmNci(3355): --
02-10 10:23:13.716: I/AudioHardwareTinyALSA(2497): AudioStreamOutALSA::write setDevice
02-10 10:23:13.741: I/BrcmNci(3355): --
02-10 10:23:13.741: I/BrcmNci(3355): RX: Type 4 Tag Response (2 bytes)
02-10 10:23:13.746: I/BrcmNci(3355): SW:0x6A82(Not Found)
02-10 10:23:13.746: I/BrcmNci(3355): --
02-10 10:23:13.746: I/BrcmNci(3355): --
02-10 10:23:13.746: I/BrcmNci(3355): TX: Type 4 Tag Command (12 bytes)
02-10 10:23:13.746: I/BrcmNci(3355): CLA:0x00
02-10 10:23:13.746: I/BrcmNci(3355): INS:0xA4(Select)
02-10 10:23:13.746: I/BrcmNci(3355): P1:0x04(Name)
02-10 10:23:13.746: I/BrcmNci(3355): P2:0x00(First or Only)
02-10 10:23:13.746: I/BrcmNci(3355): Lc:0x07(7)
02-10 10:23:13.746: I/BrcmNci(3355): Data(7 bytes)
02-10 10:23:13.746: I/BrcmNci(3355): 00 : d2 76 00 00 85 01 00
02-10 10:23:13.746: I/BrcmNci(3355): --
02-10 10:23:13.786: I/BrcmNci(3355): --
02-10 10:23:13.786: I/BrcmNci(3355): RX: Type 4 Tag Response (2 bytes)
02-10 10:23:13.786: I/BrcmNci(3355): SW:0x6A82(Not Found)
02-10 10:23:13.786: I/BrcmNci(3355): --
02-10 10:23:14.996: I/BrcmNci(3355): --
02-10 10:23:14.996: I/BrcmNci(3355): RX: Type 4 Tag Response (2 bytes)
02-10 10:23:14.996: I/BrcmNci(3355): SW:0x9000(Command Completed)
02-10 10:23:14.996: I/BrcmNci(3355): --
但是如果我们尝试使用S3,我们只得到这个日志:
01-07 03:16:47.555: D/NFCJNI(2694): Discovered P2P Target
01-07 03:16:47.555: D/NfcService(2694): LLCP Activation message
01-07 03:16:48.880: D/NFCJNI(2694): Discovered P2P Target
01-07 03:16:48.885: D/NfcService(2694): LLCP Activation message
01-07 03:16:51.860: D/NFCJNI(2694): Discovered P2P Target
01-07 03:16:51.860: D/NfcService(2694): LLCP Activation message
01-07 03:16:53.185: D/NFCJNI(2694): Discovered P2P Target
01-07 03:16:53.185: D/NfcService(2694): LLCP Activation message
01-07 03:16:58.870: D/NFCJNI(2694): Discovered P2P Target
01-07 03:16:58.870: D/NfcService(2694): LLCP Activation message
任何注册到任何NFC活动的Android应用程序都不会被唤醒。看来它们是S3和读卡器之间的一些兼容性问题,或者是S3的一些NFC实现问题。
如果两个手机的操作系统版本相同(即Android 4.3),请告诉我们为什么两部手机之间存在沟通差异。为什么S3不能超越“LLCP激活消息”?
我们正在使用的两部手机的系统信息可在此处找到
答案 0 :(得分:0)
如果您只想使用ISO-DEP卡仿真,则可能需要正确注册ACR122U NFC设备以进行被动ISO 14443-4 PICC仿真。
目前您使用TgInitAsTarget命令,如下所示:
D4 8C (TgInitAsTarget)
04 (Mode = PICC only)
0000 (ATQA/SENS_RES = invalid)
000000 (NFCID1t/UID = 0x80000000)
20 (SAK/SEL_RES = ISO 14443-4 supported)
01FE0FBBBAA6C9890000000000000000FFFF (FeliCaParams)
01FE0FBBBAA6C9890000 (NFCID3t)
06 47666D010110 (6 ATR_RES general bytes)
00 (0 historical bytes)
但是,由于您不想使用NFC-DEP模式/ FeliCa模式,您肯定希望将FeliCa参数,NFCID3t和ATR_RES通用字节设置为零。此外,您可能希望设置更有用的UID值和有效的ATQA(在其中一个位帧背叛位设置的情况下)。我不确定是否有必要,但我建议你也设置被动模式标志。
D4 8C (TgInitAsTarget)
05 (Mode = PICC only | passive mode only)
0400 (ATQA/SENS_RES)
012345 (NFCID1t/UID)
20 (SAK/SEL_RES = ISO 14443-4 supported)
000000000000000000000000000000000000 (FeliCaParams)
00000000000000000000 (NFCID3t)
00 (no ATR_RES general bytes)
00 (no historical bytes)
此外,您可能希望在某些ACR122U设备上设置其他配置寄存器。有关详细信息,请参阅this answer。