ondryaso / pi-rc522

Raspberry Pi Python library for SPI RFID RC522 module
MIT License
417 stars 149 forks source link

Read fails after some time #48

Open zlokomatic opened 6 years ago

zlokomatic commented 6 years ago

Hi,

i got two problems.

  1. wait_for_tag is not working for me - it just hangs there waiting. However i can read tags after commenting out the wait_for_tag bit
  2. After like 40 reads in a row ( not a specific number it just happens after some time ) not tags can be read anymore. It always errors out after rdr.request()

System is a fresh raspian on a raspberry zero w

layereight commented 5 years ago

Hey @zlokomatic,

can you please check whether https://github.com/ondryaso/pi-rc522/pull/49 fixes the issue for you? Thanks!

ac-astuartkregor commented 5 years ago

@layereight I am experiencing these symptoms as well. ~I tried the patch (I think) but it had no effect. I can double-check soon for you.~ I think I applied the patch incorrectly, as I am not seeing the same symptoms after applying it.

layereight commented 5 years ago

@ac-astuartkregor meaning https://github.com/ondryaso/pi-rc522/pull/49 fixes the issue for you now as well? Just asking for explicit confirmation.

ac-astuartkregor commented 5 years ago

I believe that to be the case, yes. It's the only significant thing I changed in terms of how my RFID setup works. Edit: And yes it's working continuously now.

layereight commented 5 years ago

Happy to hear that.

pitkling commented 5 years ago

I ran into a similar problem and the patch from @layereight helped, thanks!

Interestingly enough, the problem does not occur with every RFID tag. I have two different types (tokens and cards). While the tokens work flawlessly without the patch, the cards always result in failing reads when left on the RFID reader. Once the reads start to fail, none of the cards can be read anymore but the tokens can be read. Once a token was read, a card can again be read again (again, resulting in errors when left on the RFID reader for too long).

Anyway, with the patch everything seems to work, thanks again!

Wyphorn commented 5 years ago

same problem. Same fix worked. thank you!

keans commented 5 years ago

Hm, strange with fix #49 the wait_for_tag() blocks only once i.e. until the first time a tag is read. Afterwards there is no waiting for tag i.e. no blocking increasing the CPU usage to 100%. However, activating #self.irq.clear() in line 399 again makes it work for me on a Pi Zero.