Support for ISO14443B using PN532
I would like to use a Adafruit NFC shield https:/
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- nfcpy Edit question
- Assignee:
- No assignee Edit question
- Last query:
- 2015-06-19
- Last reply:
- 2015-06-20
This question was reopened
- 2015-06-19 by Aiyee
Type 4B Tags will be supported in the next release (version 0.10). Until then you could use the development branch dev-tags, the code for TTB and PN532 is supposed to be complete. Note that if you need to get driver debug logs the command line option for examples/tagtool.py has changed from "-d nfc.dev"to "-d nfc.clf.
Aiyee (lightaiyee) said : | #2 |
Is Type 4B support available in this file nfcpy-0.9.2.tar.gz?
https:/
No, you'll need to use the Bazaar client to download the dev-tags branch,
To install Bazaar: "sudo apt-get install bzr"
To get a local copy: "bzr branch lp:~stephen-tiedemann/nfcpy/dev-tags"
Aiyee (lightaiyee) said : | #4 |
Thanks Stephen Tiedemann, that solved my question.
Aiyee (lightaiyee) said : | #5 |
Sorry to re-open this thread. I got a copy of nfcpy/dev-tags using bzr. When I run the command "python tagtool.py show", I got the following error message;
File "tagtool.py", line 566, in <module>
TagTool().run()
File "tagtool.py", line 280, in __init__
parser, groups="rdwr card dbg clf")
File "C:\Users\
ch = ColorStreamHand
File "C:\Users\
self._outhdl = crtlib.
AttributeError: 'NoneType' object has no attribute 'fileno'
What could have gone wrong? I used the bzr in cygwin to download dev-tags. I am running on Windows.
The ColorStreamHandler, which is supposed to nicely paint the debug logs, seems not to be working on Windows. Replace "ch = ColorStreamHand
Please note that dev-tags is an active development branch and by far not fully tested. Development, and thus initial testing, happens on Ubuntu Linux - there may be all sorts of unrecognised bugs present in the Windows specific sections.
Aiyee (lightaiyee) said : | #7 |
Thanks for the reply. I guess I will switch to Ubuntu for trying out the dev-tags version.
Aiyee (lightaiyee) said : | #8 |
Some good news. After switching to Ubuntu, reading Type B cards work! Thank you very much for your great work.
I am using the itead NFC module which talks to the PC through UART.
http://
There is still an unfortunate problem. The tag-reading works intermittently.
I ran the command below;
$ sudo python tagtool.py --device tty:USB0:pn532
When Type B tag reading is successful, the following message is returned;
[nfc.clf] searching for reader on path tty:USB0:pn532
[nfc.clf] using PN532v1.6 at /dev/ttyUSB0
** waiting for a tag **
Type4Tag ID=95E794C6 MIU=255 FWT=0.038664
When Type B tag reading fails, the following message is returned;
[nfc.clf] searching for reader on path tty:USB0:pn532
[nfc.clf.pn532] input/output error while waiting for ack
[nfc.clf] no reader available on path tty:USB0:pn532
[main] no contactless reader found on tty:USB0:pn532
[main] no contactless reader available
Sometimes, the failure message looks like this;
[nfc.clf] searching for reader on path tty:USB0:pn532
[nfc.clf.pn532] invalid frame start sequence
[nfc.clf] no reader available on path tty:USB0:pn532
[main] no contactless reader found on tty:USB0:pn532
[main] no contactless reader available
When it starts failing, it always fail. I cannot get the tag reading working until I pull out the USB cable and reinsert again.
Aiyee (lightaiyee) said : | #9 |
One feedback is that it may be better that the returned message indicates that the card is a Type B card. Now, the message is "Type4Tag ID=95E794C6 MIU=255 FWT=0.038664" which does not tell the user whether it is Type A or Type B.
I am wondering if my problem is related to an intermittent hardware. Wonder if you have encountered similar issues before.
Thanks for the suggestion, I'll change it to Type4ATag and Type4BTag.
Regarding the error when reading, does it happen when nfcpy had before terminated with an exception? It is actually quite easy to leave the PN53x's in an inconsistent state and there's often no way to reset from software.
Btw, where did you get hold of a Type 4B Tag? I'm desperately looking for some more variety to test with.
Aiyee (lightaiyee) said : | #12 |
Your suspicion sounds logical. When the problem happens, it almost always happen until I reset the board by unplugging and replugging the USB cable. PN532 could be in an inconsistent state. How will I be able to know if nfcpy has been terminated with an exception? I cannot find any log files.
I switched to Windows because it is easier to debug in Windows. I made the code change you suggested. On Windows, I always get the error message "[nfc.clf.pn532] input/output error while waiting for ack". I suspect it is a serial driver problem in Windows. This does happen in Ubuntu but at least sometimes, it works. So far, it hasn't work in Windows before.
Aiyee (lightaiyee) said : | #13 |
Citibank issued me a credit card which happens to be a Type B card. I verified that with an Android app. Not sure if that helps. Maybe you can try your credit card?
Aiyee (lightaiyee) said : | #14 |
Amazing. You actually develop Type B code without anything to test with? Would you be so kind as to point to me which python file and code section should I refer to for this code?
I should have been more precise. The problem with reader communication I've observed frequently was when nfcpy terminated with an uncatched exception. This can easily be seen by the stack frame printed, it's quite a number of lines and explicit. If exceptions are catched then nfcpy is supposed to do clean up actions and leave the reader in a functional state. However, because dev-tags is an active development branch there are quite many changes in the driver section, it can be that clean up is not fully executed. I've recently fixed one such bug found with the rcs956 (which inherits from pn53x).
To see more of the internals printed to screen you'll need to enable debug logs. For most of the example programs that goes with "-d nfc" for debug logs from all modules in the nfc directory or '-d nfc.clf' for logs from only modules in the nfc/clf directory. Multiple "-d" options can be set.
I do actually have one Type B target, which is a TI RF430CL330H. But it would be good to have some more variety. Unfortunately my credit card is Type 4A, as well as anything that can be found on the web.
The Type 4 Tag code is in dev-trunk/
Can you help with this problem?
Provide an answer of your own, or ask Aiyee for more information if necessary.