androidtagsnfcmifarefingerprinting

How to check maximum available memory in NTAG216?


How do I determine the maximum page where I can write in NTAG216? I can't find any methods in the documentation that will let me check the maximum available memory. Also according to the documentation:

The next 36 pages are the user read/write area.

Does that mean I can only write up to page 36? I tried writing up to page 50 and it doesn't give any error.

I was using NFC Tools to check the maximum memory but once I wrote bytes starting page 4, the data about the maximum memory became unavailable.


Solution

  • How do I determine the maximum page where I can write in NTAG216?

    If you know that the tag is an NXP NTAG216 tag, then you would determine the size of the tag by looking into the datasheet. The datasheet tells you that an NTAG216 tag is organized into 231 pages, where pages 4 to 225 are user memory (i.e. the memory that you can freely use for data).

    According to the documentation, "the next 36 pages are the user read/write area." Does that mean I can only write up to page 36?

    Carefully read that documentation. It tells you that "the first 4 pages are for OTP, manufacturer data, and locking bits". And that "the next 36 pages are the user read/write area." Consequently, this means that the pages of the user memory are numbered from 4 to 40 (= 4 + 36). However, the documentation also clearly states that this only applies to MIFARE Ultralight C (MF0ICU2), which is a completely different tag type.

    How do I determine if the tag actually is a NTAG216 tag?

    You can use the GET_VERSION command to check this. If the GET_VERSION command succeeds and indicates the characteristic version information of NTAG216, you can assume that the tag actually is a NTAG216 tag.

    byte[] GET_VERSION = new byte[] { (byte)0x60 };
    byte[] result = nfca.transceive(GET_VERSION);
    if ((result != null) && (result.length == 8)) {
        // GET_VERSION command successful
        if ((result[0] == 0) && (result[1] == (byte)0x04) && (result[2] == (byte)0x04)) {
            // tag is NTAG
            if ((result[3] == (byte)0x02) && (result[4] == (byte)0x01) && (result[5] == (byte)0x00) && (result[7] == (byte)0x03)) {
                if (result[6] == (byte)0x13) {
                    // tag is NTAG216
                } else if (result[6] == (byte)0x11) {
                    // tag is NTAG215
                } else if (result[6] == (byte)0x0F) {
                    // tag is NTAG213
                }
            }
        }
    }