Can't read Type1 Tags

Asked by Juan Trujillo on 2015-07-08

I'm unable to read data (NDEF message previously stored) from two Type1 tags... Below is the output from tagtool.py utility. What am I doing wrong?

~/nfcpy/examples $ sudo python tagtool.py --device 'tty:AMA0:pn53x' -d nfc.tag
[main] enable debug output for module 'nfc.tag'
[nfc.clf] searching for reader with path 'tty:AMA0:pn53x'
[nfc.clf] using NXP PN532 at /dev/ttyAMA0
[main] touch a tag
[nfc.tag.tt1] read all
[nfc.tag.tt1] capability container e1113f00
[nfc.tag.tt1] dynamic lock byte tlv at 0xC
[nfc.tag.tt1] memory control tlv at 0x11
[nfc.tag.tt1] ndef message tlv at 0x16
[nfc.tag.tt1] while reading ndef: ValueError('invalid tlv lenght value',)
Type1Tag UID=07467600

~/nfcpy/examples $ sudo python tagtool.py --device 'tty:AMA0:pn53x' -d nfc.tag
[main] enable debug output for module 'nfc.tag'
[nfc.clf] searching for reader with path 'tty:AMA0:pn53x'
[nfc.clf] using NXP PN532 at /dev/ttyAMA0
[main] touch a tag
[nfc.tag.tt1] read all
[nfc.tag.tt1] capability container e1103f00
[nfc.tag.tt1] dynamic lock byte tlv at 0xC
[nfc.tag.tt1] memory control tlv at 0x11
[nfc.tag.tt1] ndef message tlv at 0x16
[nfc.tag.tt1] ndef message length is 86
[nfc.tag.tt1] read block at address 0x078
[nfc.tag.tt1] while reading ndef: TimeoutError('send_cmd_recv_rsp')
Type1Tag UID=c7507600

A brand new tag without data doesn't report any error:
~/nfcpy/examples $ sudo python tagtool.py --device 'tty:AMA0:pn53x' -d nfc.tag
[main] enable debug output for module 'nfc.tag'
[nfc.clf] searching for reader with path 'tty:AMA0:pn53x'
[nfc.clf] using NXP PN532 at /dev/ttyAMA0
[main] touch a tag
[nfc.tag.tt1] read all
[nfc.tag.tt1] capability container e1103f00
[nfc.tag.tt1] dynamic lock byte tlv at 0xC
[nfc.tag.tt1] memory control tlv at 0x11
[nfc.tag.tt1] ndef message tlv at 0x16
[nfc.tag.tt1] ndef message length is 0
Type1Tag UID=27417600
NDEF capabilities:
  version = 1.0
  readable = yes
  writeable = yes
  capacity = 462 byte
  message = 0 byte

Please help!

Question information

Language:
English Edit question
Status:
Solved
For:
nfcpy Edit question
Assignee:
No assignee Edit question
Solved by:
Stephen Tiedemann
Solved:
2015-07-09
Last query:
2015-07-09
Last reply:
2015-07-09

Looks like the tag memory contains wrong data. You can try with option "-v" to see a memory dump, if so please post that. Another option is to use the "dev-tags" branch (bzr branch lp:~stephen-tiedemann/nfcpy/dev-tags) where the tagtool script is more robust when printing the memory dump and is also able to format a type 1 tag. But note that I have not yet tested the dev-tags branch on Raspberry Pi (and you seem to be using one).

Here is the dump for the tag that reports 'send_cmd_recv_rsp':

[main] enable debug output for module 'nfc.tag'
[nfc.clf] searching for reader with path 'tty:AMA0:pn53x'
[nfc.clf] using NXP PN532 at /dev/ttyAMA0
[main] touch a tag
[nfc.tag.tt1] read all
[nfc.tag.tt1] capability container e1113f00
[nfc.tag.tt1] dynamic lock byte tlv at 0xC
[nfc.tag.tt1] memory control tlv at 0x11
[nfc.tag.tt1] ndef message tlv at 0x16
[nfc.tag.tt1] while reading ndef: ValueError('invalid tlv lenght value',)
Type1Tag UID=07467600
[nfc.tag.tt1] read all
  Topaz-512 (TPZ-505-016)
[nfc.tag.tt1] read block at address 0x078
[main] TimeoutError('send_cmd_recv_rsp')
TAG memory dump:
  0000: 07 46 76 00 00 10 25 00 .Fv...%.
  0008: e1 11 3f 00 01 03 f2 30 ..?....0
  0010: 33 02 03 f0 02 03 03 ff 3.......
  0018: 00 00 00 00 00 00 00 00 ........
  0020: 00 00 00 00 00 00 00 00 ........
  0028: 00 00 00 00 00 00 00 00 ........
  0030: 00 00 00 00 00 00 00 00 ........
  0038: 00 00 00 00 00 00 00 00 ........
  0040: 00 00 00 00 00 00 00 00 ........
  0048: 00 00 00 00 00 00 00 00 ........
  0050: 00 00 00 00 00 00 00 00 ........
  0058: 00 00 00 00 00 00 00 00 ........
  0060: 00 00 00 00 00 00 00 00 ........
  0068: 55 55 aa aa 12 4c 06 00 UU...L..
  0070: 01 e0 00 00 00 00 00 00 ........

Here is the dump for the second non-working tag:

[main] enable debug output for module 'nfc.tag'
[nfc.clf] searching for reader with path 'tty:AMA0:pn53x'
[nfc.clf] using NXP PN532 at /dev/ttyAMA0
[main] touch a tag
[nfc.tag.tt1] read all
[nfc.tag.tt1] capability container e1103f00
[nfc.tag.tt1] dynamic lock byte tlv at 0xC
[nfc.tag.tt1] memory control tlv at 0x11
[nfc.tag.tt1] ndef message tlv at 0x16
[nfc.tag.tt1] ndef message length is 86
[nfc.tag.tt1] read block at address 0x078
[nfc.tag.tt1] while reading ndef: TimeoutError('send_cmd_recv_rsp')
Type1Tag UID=c7507600
[nfc.tag.tt1] read all
  Topaz-512 (TPZ-505-016)
[nfc.tag.tt1] read block at address 0x078
[main] TimeoutError('send_cmd_recv_rsp')
TAG memory dump:
  0000: c7 50 76 00 00 10 25 00 .Pv...%.
  0008: e1 10 3f 00 01 03 f2 30 ..?....0
  0010: 33 02 03 f0 02 03 03 56 3......V
  0018: da 17 3a 01 61 70 70 6c ..:.appl
  0020: 69 63 61 74 69 6f 6e 2f ication/
  0028: 76 6e 64 2e 77 66 61 2e vnd.wfa.
  0030: 77 73 63 31 10 4a 00 01 wsc1.J..
  0038: 10 10 0e 00 31 10 26 00 ....1.&.
  0040: 01 01 10 45 00 03 4a 43 ...E..JC
  0048: 54 10 03 00 02 00 01 10 T.......
  0050: 0f 00 02 00 02 10 27 00 ......'.
  0058: 0b 50 65 72 65 69 72 61 .Pereira
  0060: 31 39 37 31 10 20 00 06 1971. ..
  0068: 55 55 aa aa 12 4c 06 00 UU...L..
  0070: 01 e0 00 00 00 00 00 00 ........

Finally, this is the dump for the one that is brand new:

[main] enable debug output for module 'nfc.tag'
[nfc.clf] searching for reader with path 'tty:AMA0:pn53x'
[nfc.clf] using NXP PN532 at /dev/ttyAMA0
[main] touch a tag
[nfc.tag.tt1] read all
[nfc.tag.tt1] capability container e1103f00
[nfc.tag.tt1] dynamic lock byte tlv at 0xC
[nfc.tag.tt1] memory control tlv at 0x11
[nfc.tag.tt1] ndef message tlv at 0x16
[nfc.tag.tt1] ndef message length is 0
Type1Tag UID=27417600
[nfc.tag.tt1] read all
  Topaz-512 (TPZ-505-016)
NDEF capabilities:
  version = 1.0
  readable = yes
  writeable = yes
  capacity = 462 byte
  message = 0 byte
[nfc.tag.tt1] read block at address 0x078
[main] TimeoutError('send_cmd_recv_rsp')
TAG memory dump:
  0000: 27 41 76 00 00 10 25 00 'Av...%.
  0008: e1 10 3f 00 01 03 f2 30 ..?....0
  0010: 33 02 03 f0 02 03 03 00 3.......
  0018: 00 00 00 00 00 00 00 00 ........
  0020: 00 00 00 00 00 00 00 00 ........
  0028: 00 00 00 00 00 00 00 00 ........
  0030: 00 00 00 00 00 00 00 00 ........
  0038: 00 00 00 00 00 00 00 00 ........
  0040: 00 00 00 00 00 00 00 00 ........
  0048: 00 00 00 00 00 00 00 00 ........
  0050: 00 00 00 00 00 00 00 00 ........
  0058: 00 00 00 00 00 00 00 00 ........
  0060: 00 00 00 00 00 00 00 00 ........
  0068: 55 55 aa aa 12 4c 06 00 UU...L..
  0070: 01 e0 00 00 00 00 00 00 ........

These seem all to be Topaz512 tags which the PN53x firmware does not fully support. The next version of nfcpy will lift that restriction by working around the firmware bugs. You can try out the development branch of the coming next version from "dev-tags". The only other alternative would be to use a RC-S380 reader.

Thanks a lot for all the feedback. I'll use some Type2 tags that are just working fine then.

Thanks Stephen Tiedemann, that solved my question.