ISO15693/Tag-it HF-I收发失败 [英] Transceive Failed on ISO15693 / Tag-it HF-I

查看:114
本文介绍了ISO15693/Tag-it HF-I收发失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些ISO15693/Tag-it HF-I Plus芯片,需要在上面写一些东西.这些芯片是完全新鲜的,我现在读了很多pdf告诉我都一样.但是没有任何效果,而且我总是收到收发失败"错误.

I have some ISO15693 / Tag-it HF-I Plus chips and need to write something on them. These chips are completly fresh, and i read now a ton of pdf's telling me all the same. But nothing work, and i get all the time the Transceive Failed error.

我通过收发命令发送这些数据:

I send these Data in the transceive command:

Byte:  <data>
0:     0x00 // pdf says the tag understands only flag = 0x00
1:     0x21 // write single block
2-10:  ID // needs to be send for this tag, only supports addressed mode
11:    0x00 // Block ID, try to write to block 0
12-16: DATA // LSB First
17-18: CRC16 // do i need to send this? and if yes, LSB first?

我尝试了非常不同的标志和写入模式,但是它们都不起作用:

I tried very different flags and write modes but none of them work:

Flags: 0x01, 0x02, 0x20,0x22,0x42,0x40,0x80,0x82
Modes: 0x21,0xA2 (+ Vendor Mode 0x07)

这是我的写功能:

private void write(Tag tag) throws IOException, FormatException {
if (tag == null) {
    return;
}
NfcV nfc = NfcV.get(tag);
byte[] ID = tag.getId();

nfc.connect();

Log.d(TAG, "Data: " + new String(((EmergencyApplication) getApplication()).getData()));

byte[] data = ((EmergencyApplication) getApplication()).getData();
// NfcV Tag has 64 Blocks with 4 Byte
if ((data.length / 4) > 64) {
    // ERROR HERE!
    Log.d(TAG, "too much data...");
}

for (int i = 0; i < data.length; i++) {
    byte[] arrByte = new byte[17];

    // Flags
    arrByte[0] = 0x00; // Tag only supports flags = 0
    // Command
    arrByte[1] = 0x21;
    // ID
    Log.d(TAG, "Found ID length: " + ID.length + "... ID: " + Arrays.toString(ID));
    System.arraycopy(ID, 0, arrByte, 2, 8);
    // block number
    arrByte[10] = (byte) (i);

    // data
    // TODO send LSB first...
    System.arraycopy(data, i * 4, arrByte, 11, 4);

    // CRC 16 of all command
    byte[] check = new byte[15];
    System.arraycopy(arrByte, 0, check, 0, 15);
    int crc = CRC.crc16(check);
    arrByte[15] = (byte) (crc >> 8);
    arrByte[16] = (byte) (crc & 0xFF);

    Log.d(TAG, "Writing Data: " + Arrays.toString(arrByte));

    byte[] result = nfc.transceive(arrByte);
    Log.d(TAG, "got result: " + Arrays.toString(result));
}

nfc.close();
Toast.makeText(this, "wrote to tag", Toast.LENGTH_LONG).show();

}

是Nexus S的另一个错误吗?我使用的是Cyanogenmod 10.1.2,因此我认为此处的标签丢失错误"已得到解决...显然,我可以读取标签,并且如果我使用NFC标签信息应用程序,则可以看到所有内容清晰且可写. 我将这些PDF阅读为:

Is it another bug with the Nexus S? I use Cyanogenmod 10.1.2, so i think the Tag Lost Bug is fixed here... I can obviously read the tag and if i use the NFC Tag Info App, it shows me all block clear and writeable. I have these PDFs read:

http://rfidshop.com.hk/datasheet%20tag /philip%20icode%20SLI.pdf -我的标签的数据表 http://www.waazaa.org/download/fcd-15693-3. pdf -ISO15693-3数据表 http://www.ti.com/lit/ug/scbu003a/scbu003a. pdf -Tag-it HF-I Plus数据表

http://rfidshop.com.hk/datasheet%20tag/philip%20icode%20SLI.pdf - Datasheet of my Tag http://www.waazaa.org/download/fcd-15693-3.pdf - ISO15693-3 datasheet http://www.ti.com/lit/ug/scbu003a/scbu003a.pdf - Tag-it HF-I Plus datasheet

我使用以下代码测试了阅读功能:阅读带有Android的NXP ICODE SLI-L标签-可以在所有64个块上使用,但是即使标记= 0x20 ...也仍然无法写...

I tested Reading with the code from here: Reading a NXP ICODE SLI-L tag with Android - it works on all 64 blocks but writing still doesnt work... even with flag = 0x20...

我现在看到卡上的DSFID为0x00,对于ISO15693-3来说,该卡根本不可写:

I saw now that the DSFID on the Card is 0x00, which means for ISO15693-3 that the card is not writeable at all:

如果VICC不支持其编程,则VICC应 响应值为零('00')

If its programming is not supported by the VICC, the VICC shall respond with the value zero ('00')

这是发送0x2B时的字节[]:

This is the byte[] when sending 0x2B:

                                                     DSFID \  / AFI
                                                           |  |
                                                           v  v
infoRmation: [0, 15, 120, 40, -51, -51, 119, -128, 7, -32, 0, 0, 63, 3, -117]

推荐答案

发现了一些东西,我想分享:

Found some things out, i want to share:

  • 不要先使用LSB发送数据,似乎收发命令会在发送时自动执行此操作
  • 不要使用寻址模式,似乎android实现与此有关
  • 在标志中设置选项位(0x40).
  • 我的标签似乎支持快速模式(0x02),因此您可以设置是否设置
  • 请勿设置CRC16,因为它是由android添加的

但是最糟糕的是,标签在编译到标签编写器中的时间内没有响应.您将获得Tag is lost.异常,但数据将被写入标签!因此,解决方案是忽略该异常,并在写入后验证数据,如果不起作用则重试.

But the worst thing at all is, that the Tags does not respond in the time that is compiled into the tag writer. You will get a Tag is lost. Exception but the Data will be written to the Tag! So the solution is to just ignore this exception and maybe validate the data after writing and try again if it doesnt work.

我当前的编写代码如下:

My current write code looks like this:

public static void write(Tag tag, byte[] data) throws IOException, FormatException,
InterruptedException {
if (tag == null) {
    return;
}
NfcV nfc = NfcV.get(tag);

nfc.connect();

Log.d(TAG, "Max Transceive Bytes: " + nfc.getMaxTransceiveLength());

// NfcV Tag has 64 Blocks with 4 Byte
if ((data.length / 4) > 64) {
    // ERROR HERE!
    Log.d(TAG, "too much data...");
}

if ((data.length % 4) != 0) {
    byte[] ndata = new byte[(data.length) + (4 - (data.length % 4))];
    Arrays.fill(ndata, (byte) 0x00);
    System.arraycopy(data, 0, ndata, 0, data.length);
    data = ndata;
}

byte[] arrByte = new byte[7];
// Flags
arrByte[0] = 0x42;
// Command
arrByte[1] = 0x21;

for (int i = 0; i < (data.length / 4); i++) {

    // block number
    arrByte[2] = (byte) (i);

    // data, DONT SEND LSB FIRST!
    arrByte[3] = data[(i * 4)];
    arrByte[4] = data[(i * 4) + 1];
    arrByte[5] = data[(i * 4) + 2];
    arrByte[6] = data[(i * 4) + 3];

    Log.d(TAG, "Writing Data to block " + i + " [" + printHexString(arrByte) + "]");
    try {
    nfc.transceive(arrByte);
    } catch (IOException e) {
    if (e.getMessage().equals("Tag was lost.")) {
        // continue, because of Tag bug
    } else {
        throw e;
    }
    }
}

nfc.close();
}

,效果很好. 如果出现真正的错误(例如无法理解该消息),您将收到Transceive Failed消息.

and it works pretty well. If there is a real error, like the message is not understood, you will get the Transceive Failed message.

这篇关于ISO15693/Tag-it HF-I收发失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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