ACR1252 Felica emulation

660 views Asked by At

I am using ACR1252 device connected to a windows laptop and trying to emulate a card with a URL tag. I was able to send a tag using Mifare emulation mode (the way that @michael-roland described in Accessing card-emulation mode on USB-NFC-Reader). But unfortunately, the read of the tag is not stable for android devices(the read happens only once for 15 attempts). I decided to try Felica card emulation. According the documentation of ACR1252 the byte for NFCMode in the command has to be changed:

 NfcMode 1 byte. NFC Device Mode. 
 01h = MIFARE Ultralight Card
 03h = FeliCa Card Emulation Mode

The write command is specified like: Write Card Emulation Data Command Format

But seems it is not enough because Felica has a different memory structure. My android phone reads the tag but can not recognize the content of NDEF message. Does anybody know how to change the message to make it recognizable? Any advice is highly appreciated.

When I send

E0 00 00 60 1C 01 03 00 18 E1 10 06 00 03 0F D1 01 0B 55 01 67 6F 6F 67 6C 65 2E 63 6F 6D FE 00 00

to Felica I see thisenter image description here

1

There are 1 answers

0
Kuba Drynkowski On

Got the same problem. I've solved it by sending the TAG 3 attribute block and then the NDEF message.

How to construct the attribute block check out http://apps4android.org/nfc-specifications/NFCForum-TS-Type-3-Tag_1.1.pdf#page=23&zoom=100,117,344

About the NDEF message, it needs to be without a TLV block wrapper.

NdefRecord[] records = {
            createTextRecord("en", value)
    };
    NdefMessage message = new NdefMessage(records);

    byte[] ndefMessage = message.toByteArray();

    StringBuilder hexMessage = new StringBuilder();
    for (byte b : ndefMessage) {
        hexMessage.append(String.format("%02X", b));
    }

For the attribute block:

byte[] type3AttributeBlock = {
            (byte) 0x10, // version
            (byte) numberOfBlocks[3], // number of blocks
            (byte) numberOfBlocks[3], // blocks to update
            (byte) 0x00, // H blocks available
            (byte) 0x09, // L block available
            (byte) 0x00, // byte 5 unused
            (byte) 0x00, // byte 6 unused
            (byte) 0x00, // byte 7 unused
            (byte) 0x00, // byte 8 unused
            (byte) 0x00, // writeF (00: finished)
            (byte) 0x00, // RW flag (00: read only)
            (byte) messageLengthBytes[1], // ln upper
            (byte) messageLengthBytes[2], // ln middle
            (byte) messageLengthBytes[3], // ln lower
            (byte) 0x00, // H checksum
            (byte) 0x00, // L checksum
    };

    byte[] checkSum = calculateCheckSum(type3AttributeBlock, 14);

    type3AttributeBlock[14] = checkSum[2];
    type3AttributeBlock[15] = checkSum[3];

Then combine them together and sent to the reader with control comand.