-
-
Notifications
You must be signed in to change notification settings - Fork 57
Add (partial) support for NXP Ultralight and NTAG PICCs #78
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
Conversation
`current_level_known_bits` in the select function was being incorrectly calculated from the uid_index, where on each cascade level it should be reset to 0. This resulted in an invalid command being sent to the PICC after the first level. Setting `current_level_known_bits` to 0 on level increment fixes this and allows Ultralight cards to be identified correctly. Note this issue only occurs when more than one cascade level is required, e.g. on Ultralight cards.
- Change original UL SAK type to generic UL/NTAG
- Add additional types for UL and NTAG PICC variants:
- `RC522_PICC_TYPE_MIFARE_UL_{,C,EV1_1,EV1_2,NANO,AES}`
- `RC522_PICC_TYPE_NTAG2{xx,13,15,16}`
- Add messages for new types
- Add support for GET_VERSION NXP PICC command
- Returns new `rc522_picc_version_t` struct (may be renamed)
- New function `rc522_picc_type_from_version` to deduce type from
version struct
- Implement checks for Ultralight C authentication support
- Does not provide actual authentication, just checks for AUTHENTICATE
command support. WIP: NAK should also be regarded as unsupported
- Further implement PICC type deduction per NXP AN10833
- Adds new function `rc522_mifare_get_ul_type` that implements type
deduction beyond the initial SAK check
- Adds new PICC driver rc522_nxp.{h,c} for Ultralight/NTAG (and more
broadly NXP ISO14443-3 compatible PICCs)
- Adds helper functions for retrieving page counts
- Adds support for NXP Level 3 commands: GET_VERSION, READ, WRITE,
FAST_READ, READ_CNT, PWD_AUTH, READ_SIG
- Only an NTAG215 was available for testing, so other unsupported
command not implemented
- Moves the following from `rc522_mifare` to `rc522_nxp`:
- rc522_mifare_ul_auth_supported -> rc522_nxp_keyauth_supported
- rc522_mifare_get_version -> rc522_nxp_get_version
- rc522_mifare_picc_type_from_version -> rc522_nxp_type_from_version
- rc522_mifare_get_ul_type -> rc522_nxp_get_type
- Adds constants for default PWD and PACK on password PICCs - Adds constant for the READ command buffer size - Adds functions to get the start and end page of user memory
- Examples for picc identification, page counts, READ, WRITE, FAST_READ, PWD_AUTH, READ_CNT, GET_SIG - Memory dump example
- Minor refactor to picc_nxp.c - Adds example output
Removes some unnecessary changes and removed definitions.
|
This is awesome. Thanks a lot for huge effort. Please update with main branch and clang-format new code. |
|
Having just found this repo for a project and noticing it lacks NDEF support, I find this PR. Excellent work! 🎉 |
|
Missed a file in formatting. Should be ok now (as far as I can tell). |
|
Test compiler was tripping over the fixed-width enums. I'm not entirely sure why, given they seem to work fine for me, but given they're a C23 feature I've just removed them to avoid breaking compatibility. |
abobija
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Effort is greatly appreciated. Thanks!
Adds support for the NTAG21x series of PICCs, in addition to partial support for MIFARE Ultralight variants.
Major changes:
picc/rc522_nxpwith methods for manipulating NXP PICCs with their proprietary protocol (on top of ISO14443-3)rc522_picc.hfor Ultralight and NTAG familiesI only have NTAG215s to test with, so I've only implemented the commands they support; however as NTAGs and Ultralights use predominately the same set of commands, this also adds at least partial support for Ultralight PICCs. A command support matrix is present at the start of
picc/rc522_nxp.hfor comparison across cards.The methods in
picc/rc522_nxp.hmostly provide direct access to the commands supported by the PICC (see updated README.md), as well as convenience methods for information about the memory and a method to determine the exact type of the PICC (rc522_nxp_get_type()). The example projectexamples/picc_nxp/has example usage of all of these methods.picc/rc522_nxp.halso includes commented-out stubs for commands that aren't supported on the NTAG21x. These may be useful as a starting point for future implementation, but don't currently serve any purpose.I've incremented the version to 3.3.0 as there shouldn't be any breaking changes.
Let me know if you have any questions/want me to change anything :). Thank you!