-
Notifications
You must be signed in to change notification settings - Fork 46
SPI read_passive_target timeout #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPI read_passive_target timeout #24
Conversation
Tested writing 437 bytes of data to an NTAG215. Original script: 18.9 seconds write, 19.2 seconds read. Modified script: 7.6 seconds write, 7.8 seconds read.
Moving the `with` statement seems to correct the timeout issue.
nice, did you try this on raspi only or also on some circuitpy hardware? |
Unfortunately the only things I have that will run circuitpython are Raspberry Pis. I'm still pretty new to submitting PRs, so sorry if it looks weird. |
@caternuson wanna review by checking on a samd? |
Thanks. Looks good. I recreated what I think is the original issue by doing this: >>> pn532.read_passive_target(timeout=5)
bytearray(b'&)3~')
>>> pn532.read_passive_target(timeout=5)
>>> where for the first read, the card was sitting on the reader, so could be read right away. For the second read, I put the card on the read after ~2 secs, and got nothing. With the updated code, both seem to work: >>> pn532.read_passive_target(timeout=5)
bytearray(b'&)3~')
>>> pn532.read_passive_target(timeout=5)
bytearray(b'&)3~')
>>> |
Yes, that's basically how I encountered the error as well, setting the timeout to a long value and trying to scan a tag somewhere after the initial call. |
Updating https://github.com/adafruit/Adafruit_CircuitPython_PN532 to 2.0.7 from 2.0.6: > Merge pull request adafruit/Adafruit_CircuitPython_PN532#24 from tgikal/tgikal-SPI-read_passive_target-timeout
To address the issue described in #19:
Modified the
_wait_ready
function, by avoiding re-declaring thewith
statement each iteration of thewhile
loop.