0

Is it possible to write data to specific blocks in memory on the NfcV (ISO 15693) tag? E.g. write data to block# 5 or any specific block#.

I am new to NFC technologies. I am creating an application to read/write NfcV (ISO 15693) tags. I have successfully create the reading portion but the problem is on writing portion. When I want to write some text data into the tag it start from block# 2 to onward and every time doing the same procedure. I have searched lot but I can't find any solution to write data to specific blocks.

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
Imran Zulfiqar
  • 108
  • 1
  • 1
  • 10

3 Answers3

4

The exact details depend on which ISO 15693 compatible chip is inside the tag. The ISO 15693-3 standard lists different write commands. Support for these are all optional, so your tag may support one or more of these or even use a proprietary command for writing data. I would recommend to look up the datasheet of the chip and/or acquire the ISO standard to find out what the right command is.

Once you know what the right command is, you can simply pass the bytes of the command in a byte array to the NfcV.transceive() method. (Usually the command bytes consist of a flag byte, followed by a write command byte, one or more block bytes and the data bytes to be written.)

NFC guy
  • 10,151
  • 3
  • 27
  • 58
  • Thanks for reply. I have to read the data using the code spinet. Byte[] data = nfcV.transceive((new byte[] {0, 32, block})); where 0 is flag, 32 is reading command and block is block number, which i want to read the data. this is doing well but my problem is to write data to specific block#, please give me the write direction how can i do that? – Imran Zulfiqar Oct 03 '12 at 05:34
  • It is not really possible to tell for sure without knowing which chip is inside the tag. You may want to try the "Write Block" or the "Write Multiple Blocks" commands from ISO 15693. – NFC guy Oct 03 '12 at 07:42
  • This is my NfcV (ISO 15693) Tag information. UID E004010003156650, RF technology Type V (ISO/IEC 15693 / Vicinity), Tag Type SL2 ICS2001 (ICODE SLI), Manufacturer NXP Semiconductors (Germany), Application family identifier (AFI) All families and sub-families, AFI (numeric) 00, DSF Id 00, Response flags 00, IC reference 01, Target technology classes (Android) Android.nfc.tech.NfcV, Android.nfc.tech.NdefFormatable – Imran Zulfiqar Oct 03 '12 at 07:52
  • Then the standard "Write Block" command is the command you should use, see page 11 of [the datasheet](http://www.nxp.com/documents/data_sheet/SL058030.pdf). – NFC guy Oct 03 '12 at 08:34
  • Thank you. Please explain the last point. I have read your previous answer from the link http://stackoverflow.com/questions/11387587/writing-to-a-mifare-tag-with-android-nfc. For NfcV (ISO 15693) Tag am i write to block 0 or 1?. – Imran Zulfiqar Oct 03 '12 at 09:32
  • so write command will be ?"byte[] rc = new byte[]{0xA2,0x00,my4byteData}" myNfcvObj.Transcive(rc ).but not working @ NFC Guy – Last Warrior Oct 03 '12 at 14:02
  • @ImranZulfiqar That other answer is only relevant for MIFARE Classic (which is not an NfcV or ISO 15693 chip). ICODE SLI has no reserved memory regions, the complete user memory is writeable at manufacturing. Blocks can be "locked" (made read-only) by the user. – NFC guy Oct 03 '12 at 17:00
  • 1
    @LastWarrior 0xA2 is not the ISO 15693 Write Block command byte (however, it is the MIFARE Ultralight and NFC Forum Type 2 Tag write command). The correct command byte is 0x21. It needs to be preceded by the "flags" byte (exact value of that byte depends on whether you are using, for example, selected or addressed mode). – NFC guy Oct 03 '12 at 17:06
  • Got the same problem here: according to the standard a DSFID Field = 0x00 means that the card isnt writeable at all: `If its programming is not supported by the VICC, the VICC shall respond with the value zero ('00').` – reox Aug 14 '13 at 09:15
3

Tried the following: Getting the "Tag was lost" Exception:

        nfc.connect();
        byte[] arrByt = new byte[7];
        arrByt[0] = 0x40;
        arrByt[1] = 0x21;
        arrByt[2] = 0x06;
        arrByt[3] = 0x00;
        arrByt[4] = 0x00;
        arrByt[5] = 0x00;
        arrByt[6] = 0x00;           
        byte[] response = nfc.transceive(arrByt);
Last Warrior
  • 1,307
  • 1
  • 11
  • 20
0

I guess the android framework does not handle the response from the ISO15693 tags very well. I have been playing with HF-I tags. Few commands work flawlessly and for few other commands the NFC stack throws TAG Lost exception.

perceptron
  • 167
  • 2
  • 13