PN532 Unresponsive After One Successful Scan

Bug #1498152 reported by Ben B
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
nfcpy
Invalid
Undecided
Unassigned

Bug Description

My setup:
Raspberry Pi 2 running Raspbian with a PN532 Breakout Board connected using the USB to FTDI cable sold by Adafruit.

Success case #1:
Using NFC Tools version 0.10.0, running tagtool.py, I am able to successfully read MIFARE Ultralight C tags.

Example:

 $ python examples/tagtool.py --device tty:USB0:pn532
 [nfc.clf] searching for reader on path tty:USB0:pn532
 [nfc.clf] using PN532v1.6 at /dev/ttyUSB0
 ** waiting for a tag **
 Type2Tag 'NXP NTAG213' ID=04C461224B3F80
 NDEF Capabilities:
   readable = yes
   writeable = yes
   capacity = 137 byte
   message = 3 byte
 NDEF Message:
 record 1
   type = ''
   name = ''
   data = ''

Success case #2:
If I **downgrade** to version 0.9.2, I am able to successfully read MIFARE Ultralight C tags, using a script as follows

 import nfc

 def on_connected(tag):
         print(tag)

 clf = nfc.ContactlessFrontend("tty:USB0:pn53x")
 clf.connect(rdwr={'on-connect': on_connected})

Note the use of the pn53x driver, not sure if that's significant.

Failure Case:
If, however, using nfcpy 0.10.0 I try to run the same script above except with pn532 in place of pn53x, I am able to read a tag successfully exactly once.

 pi@raspberry ~/nfcpy $ python test.py
 Type2Tag 'NXP NTAG213' ID=04C461224B3F80
 pi@raspberry ~/nfcpy $ python test.py
 Traceback (most recent call last):
   File "test.py", line 6, in <module>
     clf = nfc.ContactlessFrontend("tty:USB0:pn532")
   File "/home/pi/nfcpy/nfc/clf/__init__.py", line 72, in __init__
     if path and not self.open(path):
   File "/home/pi/nfcpy/nfc/clf/__init__.py", line 146, in open
     self.device = device.connect(path)
   File "/home/pi/nfcpy/nfc/clf/device.py", line 104, in connect
     device = driver.init(tty)
   File "/home/pi/nfcpy/nfc/clf/pn532.py", line 366, in init
     if (transport.read(timeout=100) == Chipset.ACK and
   File "/home/pi/nfcpy/nfc/clf/transport.py", line 127, in read
     raise IOError(errno.ETIMEDOUT, os.strerror(errno.ETIMEDOUT))
 IOError: [Errno 110] Connection timed out

After this happens, tagtool, the script in success case #2, and nfc-poll are all also unable to read tags from the PN532 until I unplug the USB to Serial adapter from the Pi and plug it back in.

Revision history for this message
Ben B (benberry) wrote :

This may be related to the apparent regression in Florian's 2015-09-19 post here https://answers.launchpad.net/nfcpy/+question/237349 .

description: updated
summary: - PN532 Unresponse After One Successful Scan
+ PN532 Unresponsive After One Successful Scan
Revision history for this message
Ben B (benberry) wrote :

Fixed on v.0.10 by adding `clf.close()` to the end of the `on_connected()` method.

Changed in nfcpy:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.