ACR122 - 卡模拟

发布于 2024-11-01 06:06:09 字数 151 浏览 0 评论 0原文

如何让 NFC 非接触式读卡器 ACR122U 充当标签(卡模拟模式)? 招股说明书声称该设备可以进行卡模拟,但 SDK 似乎没有提供此功能的示例或文档。

有人知道该怎么做吗? 是否需要额外的软件? 请注意,我的目标平台是 MS Windows。

提前致谢

How can I get the NFC contactless reader ACR122U to behave as a tag (card emulation mode)?
The prospectus claims that the device can do card emulation, but the SDK does not seem to provide an example or documentation for this feature.

Does anybody know how to do this?
Is there additional software required?
Please note that my target platform is MS Windows.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

不必你懂 2024-11-08 06:06:09

对于“卡模拟”或换句话说,“配置为目标并等待启动器”,请参阅此处:http://code.google.com/p/nfcip-java/source/browse/trunk/nfcip-java/doc/ACR122_PN53x.txt< /a>

** Command to PN532 **
0xd4 0x8c TgInitAsTarget instruction code
0x00 Acceptable modes
(0x00 = allow all, 0x01 = only allow to be
initialized as passive, 0x02 = allow DEP only)

_6 bytes (_MIFARE_)_:
0x08 0x00 SENS_RES
0x12 0x34 0x56 NFCID1
0x40 SEL_RES

_18 bytes (_Felica_)_:
0x01 0xfe 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7
NFCID2
0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7
?
0xff 0xff System parameters?
0xaa 0x99 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11
NFCID3
0x00 ?
0x00 ?

这是发起者激活此目标时的响应:

** Response from PN532 **
0xd5 0x8d TgInitAsTarget response code
0x04 Mode
(0x04 = DEP, 106kbps)

让我知道它是否有效!

For "Card Emulation" or in other words, "Configure as target and wait for initiators", please refer to here: http://code.google.com/p/nfcip-java/source/browse/trunk/nfcip-java/doc/ACR122_PN53x.txt

** Command to PN532 **
0xd4 0x8c TgInitAsTarget instruction code
0x00 Acceptable modes
(0x00 = allow all, 0x01 = only allow to be
initialized as passive, 0x02 = allow DEP only)

_6 bytes (_MIFARE_)_:
0x08 0x00 SENS_RES
0x12 0x34 0x56 NFCID1
0x40 SEL_RES

_18 bytes (_Felica_)_:
0x01 0xfe 0xa2 0xa3 0xa4 0xa5 0xa6 0xa7
NFCID2
0xc0 0xc1 0xc2 0xc3 0xc4 0xc5 0xc6 0xc7
?
0xff 0xff System parameters?
0xaa 0x99 0x88 0x77 0x66 0x55 0x44 0x33 0x22 0x11
NFCID3
0x00 ?
0x00 ?

This is the response when an initiator activated this target:

** Response from PN532 **
0xd5 0x8d TgInitAsTarget response code
0x04 Mode
(0x04 = DEP, 106kbps)

Let me know if it works!

夏夜暖风 2024-11-08 06:06:09

您也可以尝试以十六进制发送以下 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

Also you can try to send the following ADPU in HEX to put the reader in "Card emulation" mode:

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

只想待在家 2024-11-08 06:06:09

为了使 ACR122(或者更确切地说是其中的 PN532 NFC 控制器芯片)进入卡模拟模式,您需要执行以下操作:

  1. ReadRegister:

    <前><代码>> FF000000 08 D406 6305 630D 6338
    < D507 xx yy zz 9000

  2. 更新寄存器值:

    <前><代码>xx = xx | 0x004; // CIU_TxAuto |= InitialRFOn
    yy = yy & 0x0EF; // CIU_ManualRCV &= ~ParityDisable
    zz = zz & 0x0F7; // CIU_Status2 &= ~MFCrypto1On

  3. WriteRegister:

    <前><代码>> FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz
    < D509 9000

  4. 设置参数:

    <前><代码>> FF000000 03 D412 30
    < D513 9000

  5. TgInitAsTarget

    <前><代码>> FF000000 27 D48C 05 0400 123456 20 000000000000000000000000000000000000 00000000000000000000 00 00
    < D58D xx ... 9000

    其中 xx 应等于 0x08。

  6. 使用一系列 TgGetData 和 TgSetData 命令进行通信:

    <前><代码>> FF000000 02 D486
    < D587 xx9000

    其中xx是状态码(成功时应为0x00),C-APDU是从阅读器发送的命令。

    <前><代码>> FF000000 yy D48E
    < D587xx 9000

    其中 yy 是 2 + R-APDU(响应)的长度,xx 是状态代码(应为 0x00 其中

For getting the ACR122 (or rather the PN532 NFC controller chip inside it) into card emulation mode, you would do about the following:

  1. ReadRegister:

    > FF000000 08 D406 6305 630D 6338
    < D507 xx yy zz 9000
    
  2. Update register values:

    xx = xx | 0x004;  // CIU_TxAuto |= InitialRFOn
    yy = yy & 0x0EF;  // CIU_ManualRCV &= ~ParityDisable
    zz = zz & 0x0F7;  // CIU_Status2 &= ~MFCrypto1On
    
  3. WriteRegister:

    > FF000000 11 D408 6302 80 6303 80 6305 xx 630D yy 6338 zz
    < D509 9000
    
  4. SetParameters:

    > FF000000 03 D412 30
    < D513 9000
    
  5. TgInitAsTarget

    > FF000000 27 D48C 05 0400 123456 20 000000000000000000000000000000000000 00000000000000000000 00 00
    < D58D xx ... 9000
    

    Where xx should be equal to 0x08.

  6. 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).

妞丶爷亲个 2024-11-08 06:06:09

您可以使用 LibNFC。它有这方面的示例代码。

不幸的是,我仍然没有在 Windows 中正常工作。您可能需要为特定驱动程序编译 libnfc。

此外,许多库似乎对 ACR122u 的支持很差。显然它并不是真正为这种用途而设计的。卡模拟也存在一些特殊问题(例如超时)。我们真的需要停下来看看 ACR122u。我刚刚买了一些流行且容易买到的东西,但现在后悔了。

对于未来遇到此问题的浏览器/搜索者:请检查 libnfc 网站上的兼容性部分并购买他们推荐的东西!

You can use LibNFC. It has example code for this.

I still never got this working properly in Windows unfortunately. You will probably have to compile libnfc for specific drivers.

Also, the ACR122u seems to be pretty poorly supported by many libraries. Apparently it's not really designed for this use. There are particular issues for card emulation too (such as the timeout). We really all need to stop by the ACR122u. I just bought what was popular and easy to get hold of but regret it now.

To future browsers/searchers coming across this: please check the compatibility section on the libnfc site and buy something that they recommend!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文