pn533 reader not found at usb
Hi,
I was following the Getting Started tutorial, running the example program, using "python examples/tagtool.py show" i get following output:
[nfc.clf] searching for reader with path 'usb'
[nfc.clf] no reader found at 'usb'
[main] no contactless reader found
Running again this:
[nfc.clf] searching for reader with path 'usb'
[nfc.dev.pn53x] missing ack frame from pn53x
[nfc.clf] no reader found at 'usb'
[main] no contactless reader found
It switches every time between this two versions.
I tried this on my kubuntu 12.04 LTS 32bit and an other (fresh installed) xubuntu 64bit (don't know which one) and its still the same. My reader is called ST-Ericsson NFC device (PN533). I can use the command line tools from libusb, like nfc-list, nfc-poll, etc.
Pleease give me a tip, I'm getting mad...
thx
xiF
EDIT:
Sometimes this message is produced, I don't get the condition creating the difference:
[sudo] password for xif:
[nfc.clf] searching for reader with path 'usb'
Traceback (most recent call last):
File "examples/
TagTool().run()
File "/home/
while self.run_once() and self.options.loop:
File "/home/
try: clf = nfc.Contactless
File "/home/
if path and not self.open(path):
File "/home/
self.dev = nfc.dev.
File "/home/
usb = transport.USB(bus, dev)
File "/home/
self.
File "/home/
self.
IndexError: tuple index out of range
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- nfcpy Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Stephen Tiedemann
- Solved:
- Last query:
- Last reply:
Revision history for this message
![]() |
#1 |
Could you post a debug log of libnfc detecting and initializing the device? (I've never heard of an ST-Ericsson PN533 based reader, btw.)
Revision history for this message
![]() |
#2 |
Hi,
first thanks for your reply. I'm very new on nfc (and pretty new on Linux) and don't know where to find the debug log of libnfc, but I would be glad to give you all information, if you tell me where to find it. I hope the following information can help you.....
lsusb
:
Bus 007 Device 015: ID 04cc:2533 ST-Ericsson NFC device (PN533)
Unfortunately, I couldn't find a non-german distributor of this dongle, but here is the link to where I got it (english): http://
nfc-scan-device -v:
nfc-scan-device uses libnfc libnfc-
1 NFC device(s) found:
- NXP / PN533:
pn53x_
chip: PN533 v2.7
initator mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), ISO/IEC 14443-4B (847 kbps, 424 kbps, 212 kbps, 106 kbps), Innovision Jewel (106 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps)
target mode modulations: ISO/IEC 14443A (106 kbps), FeliCa (424 kbps, 212 kbps), D.E.P. (424 kbps, 212 kbps, 106 kbps)
I also asked someone for some help and he “debugged” your code, building checkpoints (like “print “<X>”) on some places. He said your code seems to be ok and the error(s) seems to be in pyUSB. Here's your modified code (and after that the output):
nfcpy/nfc/
import transport
usb_device_map = {
# (0x054c, 0x0193) : "pn531", # PN531 (Sony VID/PID)
# (0x04cc, 0x0531) : "pn531", # PN531 (Philips VID/PID), SCM SCL3710
(0x04cc, 0x2533) : "pn53x", # NXP PN533 demo board
# (0x04e6, 0x5591) : "pn53x", # SCM SCL3711
# (0x04e6, 0x5593) : "pn53x", # SCM SCL3712
# (0x054c, 0x02e1) : "rcs956", # Sony RC-S330/360/370
# (0x054c, 0x06c1) : "rcs380", # Sony RC-S380
# (0x054c, 0x06c3) : "rcs380", # Sony RC-S380
# (0x072f, 0x2200) : "acr122", # Arygon ACR122U
}
def connect(path):
assert isinstance(path, str) and len(path) > 0
def import_
name = "nfc.dev.
print "<2>", name
return importlib.
found = transport.
found = [(1228L, 9523L, '007', '031')]
print "<21>", found
if found is not None:
for vid, pid, bus, dev in found:
module = usb_device_
if module is not None:
/******
nfcpy/nfc/
class Chipset(object):
SOF = bytearray(
ACK = bytearray(
def __init__(self, transport):
self.CMD = PN53X_CMD
ic, ver, rev, support = self.get_
self.ic = "PN5{0:
self.fw = "{0}.{1}
print "<7>", self.ic
if self.ic == 'PN531':
elif self.ic == 'PN532':
elif self.ic == 'PN533':
def close(self):
def write_frame(self, frame):
def read_frame(self, timeout):
return self.transport.
def command(self, cmd_code, cmd_data=None, timeout=100):
"""Send a chip command and return the chip response."""
cmd_name = self.CMD.
frame = bytearray([0, 0, 255])
LEN = 2 + len(cmd_data) if cmd_data is not None else 2
if LEN < 256:
frame += bytearray([LEN, 256 - LEN, 0xd4, cmd_code])
else:
LENmsb = LEN / 256
LENlsb = LEN % 256
LCS = (256 - (LENmsb + LENlsb)) % 256
frame += bytearray([255, 255, LENmsb, LENlsb, LCS, 0xd4, cmd_code])
if cmd_data is not None:
frame += bytearray(cmd_data)
frame += bytearray([(256 - sum(frame[-LEN:])) % 256, 0])
try:
frame = self.read_
except IOError as error:
raise IOError(errno.EIO, os.strerror(
if frame[0:3] != Chipset.SOF:
raise IOError(errno.EIO, os.strerror(
print "<6>", baprint(frame), baprint(
if frame[0:
while frame == Chipset.ACK:
# transport raises IOError if timed out
try:
except IOError as error:
if error.errno == errno.ETIMEDOUT:
print "<10>"
if not frame.startswit
raise IOError(errno.EIO, os.strerror(
print "<11>"
if frame[3] == 255 and frame[4] == 255:
# extended information frame
if sum(frame[5:8]) & 0xFF != 0:
LEN, TFI, PD0 = frame[5]
else:
# normal information frame
if sum(frame[3:5]) & 0xFF != 0:
LEN, TFI, PD0 = frame[3], frame[5], frame[6]
print "<12>"
if not TFI == 0xd5:
if TFI == 0x7f: raise ChipsetError(0x7f)
raise IOError(errno.EIO, os.strerror(
if not PD0 == cmd_code + 1:
raise IOError(errno.EIO, os.strerror(
if frame[3] == 255 and frame[4] == 255:
# extended information frame
if sum(frame[
else:
# normal information frame
print "<14>"
if sum(frame[
raise IOError(errno.EIO, os.strerror(
/******
nfcpy/nfc/
def __init__(self, bus_id, dev_id):
print "<31>", self.pyusb_version
if self.pyusb_version == 0:
elif self.pyusb_version == 1:
else:
raise SystemExit
print "<32>"
print "<33>"
@property
def manufacturer_
if self.manufactur
return self.get_
@property
def product_name(self):
if self.product_
return self.get_
def _PYUSB0_
return self.usb_
def _PYUSB1_
return self.usb_
def _PYUSB0_open(self, bus_id, dev_id):
bus = [b for b in self.usb.busses() if b.dirname == bus_id][0]
dev = [d for d in bus.devices if d.filename == dev_id][0]
print "<41>", self.usb_dev, dev, dev.configurati
try:
print "<41a>"
print "<41b>"
except self.usb.USBError:
raise IOError("unusable device")
print "<42>"
if (dev.idVendor, dev.idProduct) in [(0x54c, 0x193), (0x4cc, 0x531)]:
interface = dev.configurati
endpoints = interface[
bulk_inp = lambda ep: (\
bulk_out = lambda ep: (\
print "<43>"
/******
And here is my output:
xif@xif-
[nfc.clf] searching for reader with path 'usb'
<21> [(1228L, 9523L, '007', '031')]
<2> nfc.dev.pn53x
<1> pn53x > <module 'nfc.dev.pn53x' from '/home/
<3> 007 031
<31> 0
<32>
Traceback (most recent call last):
File "examples/
TagTool().run()
File "/home/
while self.run_once() and self.options.loop:
File "/home/
try: clf = nfc.Contactless
File "/home/
if path and not self.open(path):
File "/home/
self.dev = nfc.dev.
File "/home/
usb = transport.USB(bus, dev)
File "/home/
self.
File "/home/
dev = [d for d in bus.devices if d.filename == dev_id][0]
IndexError: list index out of range
xif@xif-
INFO:nfc.
<21> [(1228L, 9523L, '007', '031')]
<2> nfc.dev.pn53x
<1> pn53x > <module 'nfc.dev.pn53x' from '/home/
<3> 007 031
<31> 0
<32>
Traceback (most recent call last):
File "examples/
HelloWorld(
File "examples/
with nfc.Contactless
File "/home/
if path and not self.open(path):
File "/home/
self.dev = nfc.dev.
File "/home/
usb = transport.USB(bus, dev)
File "/home/
self.
File "/home/
dev = [d for d in bus.devices if d.filename == dev_id][0]
IndexError: list index out of range
regards
xif
Revision history for this message
![]() |
#3 |
This is indeed a standard PN533 device (the USB Vendor ID 0x04CC was owned by Philips years back).
Please run "examples/
Revision history for this message
![]() |
#4 |
xif@xif-
[main] enable debug output for module 'nfc.dev'
[nfc.clf] searching for reader with path 'usb'
[nfc.dev.transport] using pyusb version 0.x
[nfc.dev.transport] path matches '^(usb|)$'
<21> [(1228L, 9523L, '007', '031')]
[nfc.dev] trying usb:04cc:2533
<2> nfc.dev.pn53x
[nfc.dev] import nfc.dev.pn53x
<1> pn53x > <module 'nfc.dev.pn53x' from '/home/
<3> 007 031
<31> 0
<32>
Traceback (most recent call last):
File "examples/
TagTool().run()
File "/home/
while self.run_once() and self.options.loop:
File "/home/
try: clf = nfc.Contactless
File "/home/
if path and not self.open(path):
File "/home/
self.dev = nfc.dev.
File "/home/
usb = transport.USB(bus, dev)
File "/home/
self.
File "/home/
dev = [d for d in bus.devices if d.filename == dev_id][0]
IndexError: list index out of range
Revision history for this message
![]() |
#5 |
Please use an unmodified version of the library. The statement "found = [(1228L, 9523L, '007', '031')]" inserted in function connect(path) causes confusion when later iterating the usb devices (because the device id changes every time the device is plugged in)
Revision history for this message
![]() |
#6 |
Ok, after a fresh download we get this:
xif@xif-
[main] enable debug output for module 'nfc.dev'
[nfc.clf] searching for reader with path 'usb'
[nfc.dev.transport] using pyusb version 0.x
[nfc.dev.transport] path matches '^(usb|)$'
[nfc.dev] trying usb:04cc:2533
[nfc.dev] import nfc.dev.pn53x
[nfc.dev.transport] >>> 0000ff00ff00
[nfc.dev.pn53x] GetFirmwareVersion command with timeout 100 ms
[nfc.dev.transport] >>> 0000ff02fed4022a00
[nfc.dev.transport] <<< 0000ff00ff00
[nfc.dev.transport] <<< 0000ff06fad5033
[nfc.dev.pn53x] chipset is a PN533 version 2.7
[nfc.dev.pn53x] Diagnose command with timeout 100 ms
[nfc.dev.transport] >>> 0000ff08f8d4000
[nfc.dev.transport] <<< 0000ff00ff00
[nfc.dev.transport] <<< 0000ff08f8d5010
[nfc.dev.pn53x] ATR_RES timeout: 102.4 ms
[nfc.dev.pn53x] non-DEP timeout: 51.2 ms
[nfc.dev.pn53x] RFConfiguration command with timeout 100 ms
[nfc.dev.transport] >>> 0000ff06fad4320
[nfc.dev.transport] <<< 0000ff00ff00
[nfc.dev.transport] <<< 0000ff02fed533f800
[nfc.dev.pn53x] set retries: ATR_REQ=2 PSL_REQ=1 PassiveTarget=3
[nfc.dev.pn53x] RFConfiguration command with timeout 100 ms
[nfc.dev.transport] >>> 0000ff06fad4320
[nfc.dev.transport] <<< 0000ff00ff00
[nfc.dev.transport] <<< 0000ff02fed533f800
[nfc.dev.pn53x] ReadRegister command with timeout 100 ms
[nfc.dev.transport] >>> 0000ff22ded406a
[nfc.dev.transport] <<< 0000ff00ff00
[nfc.dev.transport] >>> 0000ff00ff00
[nfc.clf] no reader found at 'usb'
[main] no contactless reader found
Revision history for this message
![]() |
#7 |
It looks like the EEPROM is not accessible (or just not present for cost reasons). Though an appropriate error response I've would have expected from the chip. Anyway, I've ordered the same reader and will check that if it arrives. For the time being you could try to replace lines 639-650 in nfc/dev/pn53x.py with the following:
device._vendor_name = "NXP"
device._device_name = "PN533"
Revision history for this message
![]() |
#8 |
Nice, I'm curious about your experience. That's what happened after replacing:
With Mifare Ultralaght tag
xif@xif-
[main] enable debug output for module 'dev.py'
[nfc.clf] searching for reader with path 'usb'
[nfc.clf] using NXP PN533 at usb:007:002
[main] touch a tag
<< waiting for tag, touching... >>
[nfc.dev] Driver.
Type2Tag ATQ=4400 SAK=00 UID=04413a1a092XXX
Yay! XD
With Mifare Classic 1K
xif@xif-
[main] enable debug output for module 'dev.py'
[nfc.clf] searching for reader with path 'usb'
[nfc.clf] using NXP PN533 at usb:007:002
[main] touch a tag
[nfc.dev] Driver.
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
[nfc.dev.pn53x] [PN53x Error 0x13] Format error during RF communication
[nfc.dev] Driver.
^Cxif@xif-
The output seems to be infinite, stops when the tag was removed and continuous when touch again. Brake just with Ctrl+C.
Next days I should get Mifare Desfire tags. I will post what happen using them.
Revision history for this message
![]() |
#9 |
Mifare Classic tags are not supported by nfcpy, that's why you see the format error reported. Any NFC Forum compatible tag should do - that's Ulralight, Desfire and NTAG if just speaking about NXP.
Revision history for this message
![]() |
#10 |
Hello,
I have the same device and I have the same problem reported in the first post.
I did what Stephen sugested (replace the lines) but then I didn't have success as xiF running "python examples/tagtool.py -d dev.py".
Can you confirm if are these the lines to change please? http://
Revision history for this message
![]() |
#11 |
Hi,
I replaced ALL the lines 639, 640, 641, .., 650. Just delete all (or comment) and copy the lines above.
Revision history for this message
![]() |
#12 |
xiF thank you for your reply. The device is being detected now! =D
For further reference, if someone has the same problem: http://
Thank you guys
Revision history for this message
![]() |
#13 |
Also, Desfire tags are recognised without problems. Great work!
xif@xif-
[nfc.clf] searching for reader with path 'usb'
[nfc.dev.pn53x] missing ack frame from pn53x
[nfc.clf] using NXP PN533 at usb:007:002
[main] touch a tag
Type4Tag ATQ=4403 SAK=20 UID=041e7269b2XXXX ATS=06757781XXXX
NDEF capabilities:
version = 2.0
readable = yes
writeable = yes
capacity = 4094 byte
message = 9 byte
NDEF record list:
record 1
type = 'urn:nfc:wkt:T'
name = ''
data = '\x02enok'
xif@xif-
Revision history for this message
![]() |
#14 |
The issue is now fixed since revision 202, the modification in pn53x.py is no longer needed.
You can use "bzr revert nfc/dev/pn53x.py && bzr pull" to upgrade.
Revision history for this message
![]() |
#16 |
Thanks Stephen Tiedemann, that solved my question.