svvitale / nxppy

Python wrapper for interfacing with the NXP EXPLORE-NFC shield for Raspberry Pi
MIT License
99 stars 34 forks source link

nxppy.SelectError: No Card detected: 4084 #42

Closed RasPinator closed 8 years ago

RasPinator commented 8 years ago

Hi there,

I'm having trouble getting a simple test python app to run on a Raspberry Pi 2 Model B running Raspbian jessie:

import nxppy

mifare = nxppy.Mifare()
uid = mifare.select()
print(uid)

I keep getting an Error at:

uid = mifare.select()

which says:

nxppy.SelectError: No Card detected: 4084

whether or not a tag is placed on the nxp-module.

After failing quite a few times I tried reading the tag with the explore-nfc basic tool and that worked...

svvitale commented 8 years ago

Can you try it in a loop just so you can be sure the card is within the field?

import nxppy
import time

mifare = nxppy.Mifare()

while True:
    try:
        uid = mifare.select()
        print(uid)
    except:
        print("No card found")
        time.sleep(1)

Also, what version of nxppy do you have installed? In older versions, you could not use the explore-nfc basic tool and nxppy at the same time. Make sure that the explore-nfc daemon is not running before trying to run the python version.

RasPinator commented 8 years ago

Thank you very much for your answer!

Unfortunately I already tried it both ways (with and without the loop). I installed nxppy via

sudo pip install nxppy

and it is version 1.4.3 Also, I did try to run it with and without the explore-nfc deamon being installed.

svvitale commented 8 years ago

I forgot to ask, is this on Raspbian? What version? I'll see if I can reproduce the issue.

On Wed, Jul 27, 2016 at 1:50 AM RasPinator notifications@github.com wrote:

Thank you very much for your answer!

Unfortunately I already tried it both ways (with and without the loop). I installed nxppy via

sudo pip install nxppy

and it is version 1.4.3 Also, I did try to run it with and without the explore-nfc deamon being installed.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/svvitale/nxppy/issues/42#issuecomment-235512371, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIXyjMrRAktuhALHTf-Gu3z3iqFjKvDks5qZw3agaJpZM4JVGvL .

RasPinator commented 8 years ago

It's Raspbian Jessie Version May 2016

svvitale commented 8 years ago

I've seen some rumblings about that release having SPI issues. Do you have an older version handy to try? I'll try to look at this myself, but my travel schedule is currently a little out of hand.

On Wed, Jul 27, 2016 at 8:59 AM RasPinator notifications@github.com wrote:

It's Raspbian Jessie Version May 2016

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/svvitale/nxppy/issues/42#issuecomment-235612853, or mute the thread https://github.com/notifications/unsubscribe-auth/AAIXykQMLiuNZikw5EZnWDF0RiA-JNCQks5qZ3JZgaJpZM4JVGvL .

RasPinator commented 8 years ago

Thank you very much!!! It works with an older Version (Linux raspberrypi 4.1.13-v7+ #826 SMP PREEMPT Fri Nov 13 20:19:03 GMT 2015 armv7l GNU/Linux)

svvitale commented 8 years ago

Glad to hear! I'll leave this ticket open until there's a new release to test against. It's possible something was purposely changed and inadvertently broke nxppy, but I'm willing to wait 1 release to verify.

svvitale commented 8 years ago

I reinstalled the latest Raspian today and successfully tested nxppy on both Python 2.7 and 3.4. The only change needed was to enable SPI. Not sure what the original problem was, but glad to hear things are working, @RasPinator. Closing this ticket.