如何让 NFC 非接触式读卡器 ACR122U 充当标签(卡模拟模式)?招股说明书声称该设备可以进行卡模拟,但 SDK 似乎没有提供此功能的示例或文档。
有人知道怎么做这个吗?是否需要额外的软件?请注意,我的目标平台是 MS Windows。
提前致谢
对于“卡仿真”或换句话说,“配置为目标并等待发起者”,请参阅此处:http ://code.google.com/p/nfcip-java/source/browse/trunk/nfcip-java /doc/ACR122_PN53x.txt
** 命令到 PN532 ** 0xd4 0x8c TgInitAsTarget 指令代码 0x00 可接受的模式 (0x00 = 全部允许,0x01 = 只允许 初始化为被动,0x02 = 仅允许 DEP) _6 字节 (_MIFARE_)_: 0x08 0x00 SENS_RES 0x12 0x34 0x56 NFCID1 0x40 SEL_RES _18 字节 (_Felica_)_: 0x01 0xfe 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7 NFCID2 0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7 ? 0xff 0xff 系统参数? 0xaa 0x99 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11 NFCID3 0x00 ? 0x00 ?
这是发起者激活此目标时的响应:
** 来自 PN532 的回应 ** 0xd5 0x8d TgInitAsTarget 响应码 0x04 模式 (0x04 = DEP,106kbps)
让我知道它是否有效!
For getting the ACR122 (or rather the PN532 NFC controller chip inside it) into card emulation mode, you would do about the following:
ReadRegister:
> FF000000 08 D406 6305 630D 6338
< D507 xx yy zz 9000
Update register values:
xx = xx | 0x004; // CIU_TxAuto |= InitialRFOn
yy = yy & 0x0EF; // CIU_ManualRCV &= ~ParityDisable
zz = zz & 0x0F7; // CIU_Status2 &= ~MFCrypto1On
WriteRegister:
> FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz
< D509 9000
SetParameters:
> FF000000 03 D412 30
< D513 9000
TgInitAsTarget
> FF000000 27 D48C 05 0400 123456 20 000000000000000000000000000000000000 00000000000000000000 00 00
< D58D xx ... 9000
Where xx
should be equal to 0x08.
Communicate using a sequence of TgGetData and TgSetData commands:
> FF000000 02 D486
< D587 xx <C-APDU> 9000
Where xx
is the status code (should be 0x00
for success) and C-APDU is the command sent from the reader.
> FF000000 yy D48E <R-APDU>
< D587 xx 9000
Where yy
is 2 + the length of the R-APDU (response) and xx
is the status code (should be 0x00
for success).
您也可以尝试以 HEX 格式发送以下 ADPU 以将读卡器置于“卡仿真”模式:
FF 00 00 00 27 D4 8C 00 08 00 12 34 56 40 01 FE A2 A3 A4 A5 A6 A7 C0 C1 C2 C3 C4 C5 C6 C7 FF FF AA 99 88 77 66 55 44 33 22 11 00 00
您可以使用 LibNFC。它有这方面的示例代码。
不幸的是,我仍然无法在 Windows 中正常工作。您可能必须为特定驱动程序编译 libnfc。
此外,许多库似乎对 ACR122u 的支持很差。显然,它并不是真正为这种用途而设计的。卡模拟也存在特殊问题(例如超时)。我们真的都需要在 ACR122u 前停下来。我刚买了流行且容易掌握的东西,但现在后悔了。
对于将来遇到此问题的浏览器/搜索者:请检查 libnfc 网站上的兼容性部分并购买他们推荐的东西!