2015-09-21 19:33:02 |
Ben B |
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:
[code]$ 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 = ''[/code]
Success case #2:
If I [b]downgrade[/b] to version 0.9.2, I am able to successfully read MIFARE Ultralight C tags, using a script as follows
[code]import nfc
def on_connected(tag):
print(tag)
clf = nfc.ContactlessFrontend("tty:USB0:pn53x")
clf.connect(rdwr={'on-connect': on_connected})[/code]
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.
[code]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[/code]
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. |
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. |
|