NFC ACR122 TgInitAsTarget,发起方释放目标 [英] NFC ACR122 TgInitAsTarget, initiator releasing target

查看:182
本文介绍了NFC ACR122 TgInitAsTarget,发起方释放目标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让我的ACR122(usb)设备模仿无源NFC标签,但是在使通信正确进行方面遇到困难.我希望有人能在这里看到我在做什么错,并帮助我指出正确的方向.

I'm trying to get my ACR122 (usb) device to emulate a passive NFC tag, but am having difficulty getting the communication to occur properly. I'm hoping someone can see what I'm doing wrong here and help point me in the correct direction.

对另一个问题的回答 ACR122-卡仿真指向文档,网址为 http://code. google.com/p/nfcip-java/source/browse/trunk/nfcip-java/doc/ACR122_PN53x.txt ,但是当我们将其紧跟字母时,它的表现将不符合预期.

The response on this other question ACR122 - Card Emulation pointed to a document at http://code.google.com/p/nfcip-java/source/browse/trunk/nfcip-java/doc/ACR122_PN53x.txt but when we follow this to the letter it doesn't behave as expected.

我们正在使用Samsung Galaxy S3 Android 4.3设备进行测试,并且看到以下行为:

We're using an Samsung Galaxy S3 Android 4.3 device for testing, and are seeing the below behaviour:

Transmit (TgInitAsTarget)
....'......4V@..  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 
...wfUD3"...      AA 99 88 77 66 55 44 33 22 11 00 00 

Receive
..%....7.5<...w.  D5 8D 25 1E D4 00 08 37 D9 35 3C BF D5 AE 77 9C 
...2Ffm.........  00 00 00 32 46 66 6D 01 01 11 03 02 00 13 04 01 
...               96 90 00 

Transmit (GetData)
.......           FF 00 00 00 02 D4 86 

Receive
..)..             D5 87 29 90 00 

TgInitAsTarget命令似乎正在运行,返回0x25的模式,我们知道这意味着活动模式,DEP,424kbps".

The TgInitAsTarget command appears to be working, returning a mode of 0x25 which we understand means "Active mode, DEP, 424kbps".

但是随后"GetData"命令立即失败,返回状态码0x29配置为目标的PN532已被其启动程序释放."

But then "GetData" command is immediately failing, returning status code 0x29 "The PN532 configured as target has been released by its initiator".

我们尝试使用不同的模式(而不是0x00全部"模式)更改TgInitAsTarget命令,并尝试执行以下操作,但对于以下GetData命令,它们仍然返回0x29:

We've tried altering the TgInitAsTarget command with different modes (instead of the 0x00 "All" mode), trying the following which all still return 0x29 for the following GetData command:

  • 模式0x01被动",导致响应模式为0x04"DEP"
  • 模式0x02"DEP",导致响应模式为0x25(与全部"相同)
  • 模式0x03"DEP被动"导致响应模式为0x04"DEP"

在所有情况下,似乎Android都无法维持连接,尽管我对NFC DEP协议还不足够了解,以至于我在这里做错了什么.我已经阅读了PN532芯片参考,似乎表明我在做所有正确的事情.

It appears in all cases as if the Android is not maintaining the connection, although I am not familiar with the NFC DEP protocols enough to know what I'm doing wrong here. I've read the PN532 chip reference, and it seems to indicate that I'm doing everything correctly.

我也尝试过Windows Phone NFC设备,它在GetData上遇到相同的问题和相同的错误代码.

I've also tried a Windows Phone NFC device, and it encounters the same problem and same error code on GetData.

任何熟悉NFC的人的帮助都将不胜感激.

Any help from anyone who is familiar with NFC would be greatly appreciated.

戴夫

推荐答案

要使ACR122(或更确切地说是其中的PN532 NFC控制器芯片)进入卡仿真模式,请执行以下操作:

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:

  1. 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:

  • WriteRegister:

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

  • SetParameters:

  • SetParameters:

    > FF000000 03 D412 30
    < D513 9000
    

  • TgInitAsTarget

  • TgInitAsTarget

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

    xx应等于0x08.

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

    Communicate using a sequence of TgGetData and TgSetData commands:

    > FF000000 02 D486
    < D587 xx <C-APDU> 9000
    

    xx是状态码(成功时应为0x00),C-APDU是读取器发送的命令.

    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
    

    yy是2 + R-APDU的长度(响应),而xx是状态码(成功应为0x00).

    Where yy is 2 + the length of the R-APDU (response) and xx is the status code (should be 0x00 for success).

    这篇关于NFC ACR122 TgInitAsTarget,发起方释放目标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆