Ultralight C Counter Increment

Forum / MIFARE SDK / Ultralight C Counter Increment

  • 7. June 2016 at 16:45
    Hi there,

    we are trying to increase the Ultralight C counter with the methods in Mifare SDK Lite, according to the Javadoc (which is also Lite)


    void counterIncrement(int value)
    throws IOException
    Increments the counter by a specific value.
    Parameters:
    value - Value to be added to the counter.
    Throws:
    IOException - Signals that an I/O exception of some sort has occurred. This class is the general class of exceptions produced by failed or interrupted I/O operations.


    We just need to set a specific value. We have some errors and concerns:


    1. We've got IOException if the value is higher of 15. No documentation at all.

     
    06-07 14:38:52.820 16331-20561/com.glownet.next.qa W/System.err: java.lang.IllegalArgumentException: Value should be between 0 and 15
    06-07 14:38:52.835 16331-20561/com.glownet.next.qa W/System.err: at com.nxp.nfclib.ultralight.UltralightC.counterIncrement(:783)
    06-07 14:38:52.835 16331-20561/com.glownet.next.qa W/System.err: at com.glownet.next.nfc.ultralightC.UltralightCNxpTagReader.counterIncrement(UltralightCNxpTagReader.java:81)


    2. According to Ultralight C Datasheet [1] there is needed to do a write before, event with zeros. Are you doing this before?
    If we write the page with an initial value we get:

     
    06-07 14:19:42.275 23482-4676/com.glownet.next.qa W/System.err: java.io.IOException
    06-07 14:19:42.280 23482-4676/com.glownet.next.qa W/System.err: at com.nxp.nfclib.AndroidApduHandler.apduExchange(:57)
    06-07 14:19:42.280 23482-4676/com.glownet.next.qa W/System.err: at com.nxp.nfclib.ultralight.ULBase.write(:348)
    06-07 14:19:42.280 23482-4676/com.glownet.next.qa W/System.err: at com.glownet.next.nfc.ultralightC.UltralightCNxpTagReader.counterIncrement(UltralightCNxpTagReader.java:81)


    3. If we set a value within [1-15] we also have a IOException with this trace:

     
    06-07 14:31:18.520 13240-14236/com.glownet.next.qa W/System.err: java.io.IOException
    06-07 14:31:18.520 13240-14236/com.glownet.next.qa W/System.err: at com.nxp.nfclib.AndroidApduHandler.apduExchange(:57)
    06-07 14:31:18.520 13240-14236/com.glownet.next.qa W/System.err: at com.nxp.nfclib.ultralight.UltralightC.counterIncrement(:794)
    06-07 14:31:18.520 13240-14236/com.glownet.next.qa W/System.err: at com.glownet.next.nfc.ultralightC.UltralightCNxpTagReader.counterIncrement(UltralightCNxpTagReader.java:81)


    As you may notice, error 2 and 3 are the same, so, ¿is there any extra step needed to increase the counter?

    [1] http://www.nxp.com/documents/data_sheet/MF0ICU2.pdf

    Thank you in advance,
    Cheers.
    + 0  |  - 0

    Re: Ultralight C Counter Increment

    24. June 2016 at 18:17
    Is this a bug? Could you please give me some feedback?
    + 0  |  - 0

    Re: Ultralight C Counter Increment

    28. June 2016 at 10:21
    WordPress › Error

    There has been a critical error on this website.

    Learn more about troubleshooting WordPress.