2

I am wondering if anyone out there has stumbled across the issue I am experiencing.

I am writing an app to talk to a specific ISO 15693 RFID Chip using the Nexus S NFC capabilities. Communication between the phone and the chip works fine, most of the time. Reading and Writing the blocks is also working using transcieve() to send raw byte-arrays.

My chip has 8 blocks, each 4 bytes big. When I am trying to write to a block other than 0 - 7, Android throws a TagLostException:

07-21 14:07:39.390: WARN/System.err(5770): android.nfc.TagLostException: Tag was lost.
07-21 14:07:39.394: WARN/System.err(5770):     at android.nfc.tech.BasicTagTechnology.transceive(BasicTagTechnology.java:141)
07-21 14:07:39.398: WARN/System.err(5770):     at android.nfc.tech.NfcV.transceive(NfcV.java:92)
07-21 14:07:39.398: WARN/System.err(5770):     at de.myapp.ForegroundDispatchNfcV.sendRawCommand(ForegroundDispatchNfcV.java:246)
07-21 14:07:39.402: WARN/System.err(5770):     at de.myapp.ForegroundDispatchNfcV$3.onClick(ForegroundDispatchNfcV.java:135)
07-21 14:07:39.406: WARN/System.err(5770):     at android.view.View.performClick(View.java:2485)
07-21 14:07:39.406: WARN/System.err(5770):     at android.view.View$PerformClick.run(View.java:9080)
07-21 14:07:39.410: WARN/System.err(5770):     at android.os.Handler.handleCallback(Handler.java:587)
07-21 14:07:39.414: WARN/System.err(5770):     at android.os.Handler.dispatchMessage(Handler.java:92)
07-21 14:07:39.414: WARN/System.err(5770):     at android.os.Looper.loop(Looper.java:123)
07-21 14:07:39.417: WARN/System.err(5770):     at android.app.ActivityThread.main(ActivityThread.java:3683)
07-21 14:07:39.421: WARN/System.err(5770):     at java.lang.reflect.Method.invokeNative(Native Method)
07-21 14:07:39.421: WARN/System.err(5770):     at java.lang.reflect.Method.invoke(Method.java:507)
07-21 14:07:39.425: WARN/System.err(5770):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-21 14:07:39.429: WARN/System.err(5770):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-21 14:07:39.429: WARN/System.err(5770):     at dalvik.system.NativeStart.main(Native Method)

What I would expect from reading the ISO 15693 standard would be to get back 2 bytes containing infos on the error that occured, but it seams as if the chip would just stay quiet and send no answer. The same issue also occurs when trying to read a block that's not valid.

Is this a issue with my card or maybe something in the API / NFC ? Does anyone know more about this issue?

Michael Roland
  • 39,663
  • 10
  • 99
  • 206
sege
  • 81
  • 1
  • 7

2 Answers2

0

The NFC chip has an internal state machine that keeps track of what tags it has detected. When the tag is out of range of the reader/phone and you try to write to it you will get this exception.

Michael Elias
  • 212
  • 1
  • 4
  • Thanks for your answer. This is actually not my problem. The chip stays in the field. When removing the RFID Chip from the field, I get a different message (Tag lost, restarting polling loop). Also, when I catch the exception shown above, I can read and write all valid blocks right after that without a problem! – sege Jul 27 '11 at 07:28
  • If the card returns a non success status code (9000) I assume android's NFC stack assumes its an exception and thus throws one. If you can still write to the tag after the exception just make your routine handle the exception as part of a possible response... If the problem is your tag you could make a little program that uses an USB NFC reader to write the same commands and see what responses you get. You can get cheap USB NFC readers on the web (ACR122U is what is use) – Michael Elias Jul 28 '11 at 16:14
0

I had this problem when the card was sending back an incorrect CRC to the Nexus S.

Ben
  • 19
  • 3