Unknown Error Exception Thrown For NTag203x Tags

Forum / MIFARE SDK / Unknown Error Exception Thrown For NTag203x Tags

  • 23. April 2015 at 10:49
    Hi ,

    I'm using Advanced SDK with NTag 203 NFC tags. Whenever i tap the tag, following error is logged onNewIntent for filter intent. It says UNKNOWN ERROR. I don't now what it means.

    Also its taking almost 300 milliseconds to start the callback. Why this much time is consumed by library.

    I/SDK? This is NXP Card
    04-23 13:32:00.262 W/System.err? com.nxp.nfclib.exceptions.SmartCardException: Unknown Error.
    04-23 13:32:00.270 W/System.err? at com.nxp.nfclib.ntag.NTag.?(:239)
    04-23 13:32:00.270 W/System.err? at com.nxp.nfclib.ntag.NTagFactory.getNTAG(:223)
    04-23 13:32:00.270 W/System.err? at com.nxp.nfclib.Interface.NxpNfcLib.?(:449)
    04-23 13:32:00.270 W/System.err? at com.nxp.nfclib.Interface.NxpNfcLib.filterIntent(:373)
    04-23 13:32:00.270 W/System.err? at com.comp.testNTag.HomeActivity.onNewIntent(HomeActivity.java:459)
    04-23 13:32:00.278 W/System.err? at android.app.Instrumentation.callActivityOnNewIntent(Instrumentation.java:1161)
    04-23 13:32:00.278 W/System.err? at android.app.ActivityThread.deliverNewIntents(ActivityThread.java:2330)
    04-23 13:32:00.278 W/System.err? at android.app.ActivityThread.performNewIntents(ActivityThread.java:2343)
    04-23 13:32:00.278 W/System.err? at android.app.ActivityThread.handleNewIntent(ActivityThread.java:2352)
    04-23 13:32:00.278 W/System.err? at android.app.ActivityThread.access$1400(ActivityThread.java:141)
    04-23 13:32:00.278 W/System.err? at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
    04-23 13:32:00.286 W/System.err? at android.os.Handler.dispatchMessage(Handler.java:99)
    04-23 13:32:00.286 W/System.err? at android.os.Looper.loop(Looper.java:137)
    04-23 13:32:00.286 W/System.err? at android.app.ActivityThread.main(ActivityThread.java:5103)
    04-23 13:32:00.286 W/System.err? at java.lang.reflect.Method.invokeNative(Native Method)
    04-23 13:32:00.286 W/System.err? at java.lang.reflect.Method.invoke(Method.java:525)
    04-23 13:32:00.293 W/System.err? at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
    04-23 13:32:00.293 W/System.err? at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    04-23 13:32:00.293 W/System.err? at dalvik.system.NativeStart.main(Native Method)
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 11:16
    As a result of this delay ~300 milliseconds,

    When i read NDEF, mostly it says, "Tag Lost". Now, other applications successfully read immediately once tag is recognized no matter how quick Tag is attached and detected.

    I don't know what are development people processing while detecting card type and returning the appropriate call back. it should not take this much time.

    I don't want to write my own call back logic after reading card type my self.

    Please help!
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 13:18
    Can you atleast please post some of your code that you are using?
    Especially if such error occurs, I need to see your code. Post it here.


    "Tag Lost" means that the card was formatted and not personalized again for use. But I need to see your code, to see exactly what you're doing.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 14:36
    Hi,

    I'm using exact copy of sample application code. On new intent , following line throws the exceptions,

    protected void onNewIntent(final Intent intent)
    {

    libInstance.filterIntent(intent, callback); This is non-reachable code. I don't have source code for this one.

    super.onNewIntent(intent);
    }


    Sometimes, Unknown Error or IO Exception.

    Good thing is that i can read my data successfully even after these exception if i keep the tag attached to phone for 2-3 seconds.

    I'm just concerned about late response of application after the tag is recognized.

    99% my Nexus 7 5.1 is able to recognize the tag with the notification sound but read operation does not happen because either the NXPnfclib has crashed due to some "IO Exception or Transcive exception" or even spent too much time returning to callback so that i can continue my logic.

    From new intent to callback method it takes 150 milliseconds on ASUS Nexus 7.
    Rest of my logic takes 15 milliseconds.

    So, in my understanding of this issue, MiFARE library is doing alot of processing.


    This issue is easily reproducible with sample app.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 14:40
    Also, NTag203x don't have any personalize method. I think it doesn't need this process.

    Secondly, i only format NFC tag if its not already T2 formatted. Otherwise i just overwrite the NDEF message. So, it should not return "Tag Lost" exception if it works the way you say.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 14:58
    Can you try this:


    protected void onNewIntent(Intent intent) {
    libInstance.filterIntent(intent, new Inxpnfclibcallback() {
    @Override
    public void onNTag203xCardDetected(NTag203x arg0) {
    Log.i(TAG,"NTAG 203x card Detected" );
    arg0.connect();
    }
    }
    }


    Not sure if you have used this method, but this one is from the Manual that I have. Try to use this identically as I copied it here, but with your logic.

    Let me know. In mean time I'll try to grab my hands on NTag203 and test it out on my own.

    BR,
    David
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 15:13
    David,

    I appreciate your help but my callback was defined as a separate variable like,

    protected void onNewIntent(Intent intent) {
    libInstance.filterIntent(intent, callback)

    }

    Nxpnfclibcallback callback = new Nxpnfclibcallback()
    {
    @Override
    public void onNTag203xCardDetected(NTag203x arg0) {
    Log.i(TAG,"NTAG 203x card Detected" );
    arg0.connect();
    }
    }

    I don't think android dislike this notation. Anyways, tried your code and its behaving same.:-|
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 15:33
    Try to read tag with NXP TagWriter from google play store. It works amazing. Seldom fails to read if recognized. We want our application reliable like that one.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 16:00
    So let me understand this correctly:

    Your main problem is that the communication is too slow for you ? You want your tag to be recognized faster and it's logic applied faster ?

    Or is your problem that your Tag is not detected at all?

    Do you have more Tags / NFC phones on your hand - to maybe test different devices / tags ?
    But you did say, that the Tag Writer works lovely..so might be a long shot, but still you could try.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 16:25
    David,

    Tag is recognized faster (recognized in onNewIntent) but MiFARE SDK(Intent filter) takes almost 200 milliseconds to make callback that contains my logic.

    I have more than 10 tags and couple of devices Galaxy Nexus, ASUS Nexus 7 tab etc.

    The sooner i'll get the call back, the sooner i'll be able to perform my logic. Is there any work around?
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 16:56
    bilalahmadbrw:

    I have tested it on my Galaxy S4 and i also recieve delay between 150-200ms. The speed varied depending on how good I placed the Tag corresponding to the NFC Chip inside my phone (if I placed it on chip directly, it was faster : 150ms, if I put it random it was cca 200ms).

    Then I tested it with my Nexus 7 2012 (which has NXP chip inside it), it resulted in the same delay as before, but only here I recieved the error "Unknown error".


    I will take a more in-depth look to this over the weekend and hopefully come out with some work around.

    Until now, that's all I can do Bilal, sorry.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    23. April 2015 at 17:47
    It's okay. :-)

    At least someone has same issue reproduced, enough for today.

    And
    We live to fight another day.

    Thanks,
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    24. April 2015 at 12:54
    Hey Bilal!
    Got news for you.

    I have recieved an answer regarding your issue:

    "This happens because our detection logic is supposed to discover any tag. NTAG203x matches with Ultralight and to confirm, we actually do perform card specific operations and so this delay is there. Also as you know, some middleware implementations for ultralight are slow."

    So for now we have to "live with it", but suggestions to create a workaround are now in motion.



    I was thinking, if you arelly need it to work faster than 200ms, the posibility would be perhaps to create a method with Android standard NFC Library. Haven't tested it, because it ofcourse requires much more time to develop such system - but if you really need it, it might be a way.

    BR,
    David
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    27. April 2015 at 11:15
    Thanks David.

    I forgot to monitor my reply and didn't get any notification about your response.

    Anyways, if that is the case, I need to find out some work around indeed.

    This also raises a question, is NXP Tag Writer application based on this MiFARE SDK? If yes then that application should also behave same but it does not. :-)

    I have implemented NFC adaptor logic before in another application and it does not ever say that card is lost.

    We really need it fast. Current behavior is not accepted under any circumstance. We can't request users to keep the tag attached for couple of seconds.:-|

    Once android phone notify using the tone, user should be able to detach the tag and data should be read every time. This is the best case scenario we are looking for.

    Thanks for help.
    Good Day.
    + 0  |  - 0

    Re: Unknown Error Exception Thrown For NTag203x Tags

    27. April 2015 at 13:05
    Hey Bilal!

    1. The NXP Tag Writter is developed with MIFARE SDK. The difference in detection could be due to different versions of SDK. Because the Tag Writter was developed inside NXP Team and the developper probably recieved some of the earlier versions of the SDK. I can only guess and I do not know if there are any older versions available.

    2. The issue here is defineatly on SDK side. For now, either you try and go for some of your own work around or wait for a newer version of SDK, which promises following:
    -> If you already know which Tag you want to detect, you will be able to filter it (means, you can skip the detection phase)

    This will most probably fix your issue then. However, as you said you need immediate, I got some info that the newer version with that fix will be released in June (most probably begining of June).

    I am sorry that I could not have been more of a help in your case. :/

    BR,
    David
    + 0  |  - 0
Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in to reply to this topic.