-
Notifications
You must be signed in to change notification settings - Fork 393
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
馃殌 | Support ntag NFC Chips with rc522 #2373
Comments
Thanks for your feature request. The current Phoniebox implementation for rc522 readers seems to have issues with tags, which require(?) authentication. The GitHub repo of the used rc-522 library seems to have recent activity (again). If I understand the readme example correctly https://github.com/ondryaso/pi-rc522?tab=readme-ov-file#usage the |
Looking at our code in V2 the implementation might be too simple, just ignoring auth? @AlvinSchiller |
@lukruh I think you are currently referring to V2 implementation (using Reader.experimental.py), so I tagged the issue accordingly. Nevertheless we need to check V3 as well. |
Looking at https://github.com/MiczFlor/RPi-Jukebox-RFID/blob/future3%2Fdevelop/src%2Fjukebox%2Fcomponents%2Frfid%2Fhardware%2Frc522_spi%2Frc522_spi.py#L100-L131 the V3 has the same (maybe too simple?) implementation. |
If pi-rc522 library supports ntags and we need to improve our implementation this should be the way to go from my point of view. The mfrc522 library seems to support it, but there is no activity for almost 4 years, so I'm not sure, if this helps us in the future. We also need to consider the RPi.GPIO issue for Raspberry Pi OS Bookworm (at least for V3), see #2313 (comment) |
Yes, it looks like the case is just not covered, also in v3. |
Agree in all points 馃憤 |
I got a couple of the ntag215 ones and can try to get to ignore auth in pi-rc522.
|
I have a working update for pi-rc522 that does work for ntag215 and the classic cards. Ntag cards tend to cause more read errors (could also be cheap tags being crappy). I modified it based on the pattern from this other repo. I'd prefer to find the official docs laying out the sequence of events but this works. I'll put together an MR for pi-rc522 and see how that goes, that repo is pretty dead aside from a readme change |
Would anyone be willing to take a look at something? I am running into some weird behavior and I'm not sure what is going on. HOWEVER, the service does not seem to be having the same luck - I do not see the load at the end of my custom class's constructor hitting the log. Is this just an issue with relative paths for the new class? |
I've hit a wall. I can't understand why the wait_for_tag() method works correctly in debug but not when I run the script normally. Could be a timing issue that needs to be resolved between the two. Here is the doc that outlines the comms, and honestly it looks like the existing code should have handled 7 byte (but not 10) UIDs. I ordered a stack of classic cards in the mean time |
Do you have a branch or a PR yet? It would probably help, if people could look at the code to help. |
Yeah let me clean things up. I am going to separate my changes, revert the repo and diff things. It's just bizarre. I think most of the code to properly grab NTag 21x UIDs is there (maybe minus another select command). I got frustrated with whatever was happening with Python debug vs normal and decided to look into .NET IoT libraries. I am writing this now looking at my cheap MRFC522 spitting out NTag215 UIDs like crazy, and handling the classics just fine using the .NET libraries. This works for me for now because I can just mimic the script behavior with the dll, but I'll take another look at the python piece since I don't want to leave everyone hanging |
Diffing the current pi rfc522 library against the working c# libraries, a few things stand out
The libraries diverge quick from there. The C# library handles cascading internal to the Select command, and again the registers/values look. I'm a few years removed from working with hardware and rarely use python, but I can't imagine there differences aren't leading to problems. If you check out the class ESPHome uses alongside it's python, the c class write similar values to the c# source, and I haven't seen threads for Home Assistant complaining about it My apologies but for now this is the most I can do - it's a large rewrite from initial glance but someone more versed in python should double check |
Feature
Extend the
Mfrc522Reader
class to support cheap NFC chips like ntag215. This might require switching to another library. The currently used pi-rc522 seems not to support the newer ntag chips. There are several other libraries, that might support the ntag type chips as well as the currently supported s50/s70 types.I don't have experience with RFID/NFC or the phoniebox it self. But I'm happy to share my current workaround or help implementing a more general solution. Maybe some more experienced users/devs want to jump in for discussion.
(I will link related Issues later).
User perspective
From reading the docs (before #2372) here in the repo and/or the description of the RC522 users (like me) might expect all NFC tags are supported as long as the frequency matches. The ntag type chips seem to be very common on the market. For users who got some of these it should be possible to use them without touching the code.
Further information
I managed to use the phoniebox with ntag type chips by adding a reader based on the mrfc522 library with some copy pasted code from their examples and other github issues to work around Auth errors. This could be at least a preliminary solution for users who only want to use this type of chips:
I have adjusted the Reader class and setup script accordingly to switch between the current reader and this workaround.
The text was updated successfully, but these errors were encountered: