Today I finally finished my rewrite of the MFRC522 library and sent a pull request to the upstream repository: https://github.com/miguelbalboa/rfid/pull/9. Now I look forward to hear Miguel's response - will he welcome my changes or reject them as "too invasive"?
Since last time I also added functions to use the MIFARE Classic Decrement/Increment/Restore/Transfer commands and an example of how to use them (it requires changing the sector trailer).
The next step in the project is building the electronics for driving a Ruko/Abloy EL582 solenoid lock I have bought for use in this project. I expect that to be a lot simpler than rewriting the MFRC522 library ;-)
Showing posts with label ISO 14443-3 A. Show all posts
Showing posts with label ISO 14443-3 A. Show all posts
Sunday, October 20, 2013
Pull request sent
Wednesday, October 16, 2013
MFRC522 library cleanup
Almost 8 weeks ago I wrote: "I will translate the comments to English, clean up, and implement proper anticollision and support for 7 and 10 byte UIDs."
I have now finished the following subjects:
So now I actually believe I will finish this job - and hopefully soon so I can get on to building some electronics for the electric lock.
I have now finished the following subjects:
- Anticollision
- 4, 7 and 10 byte UIDs (ie cascade levels 1, 2 and 3)
- Cleanup
- Verbose comments in English
- Tested Authentication and reading from MIFARE Classic cards.
I still need a little work on:
- Testing writes to MIFARE Classic cards (should not be a problem).
- Support for reading and writing MIFARE Ultralight cards.
- Updated example scripts
- Updated keywords.txt
So now I actually believe I will finish this job - and hopefully soon so I can get on to building some electronics for the electric lock.
Thursday, August 22, 2013
MIFARE: Initialization and anticollision
Oh my - where did those four weeks go? Well, vacation and getting back to work took most of my time - but I did do a little work on the project.
The Nokia 5110 84x48 pixel display I mentioned last was tested briefly. The code from Adafruit worked just fine - and so did the backlight when I stopped connecting the pin to Vcc and used GND instead. Doh!
The MIFARE reader kit has arrived. It is based on the NXP MFRC522 Contactless Reader IC, and uses SPI for communication with the micro controller. The data sheet for the MFRC522 IC clearly documents how to operate the reader chip, and (I quote) "The digital module manages the complete ISO/IEC 14443 A framing and error detection (parity and CRC) functionality." So far so good. But not a word about the protocol for communicating with the MIFARE chips.
Some time with google.com reveals that the first level of missing information is contained in "ISO/IEC 14443-3 Identification cards -- Contactless integrated circuit cards -- Proximity cards -- Part 3: Initialization and anticollision". It is available for CHF 162 (about USD 175)! Hrmm - more than I like. Luckily the final draft from the WG8 working group is freely available here! Using this protocol I can get the UID of the RFID card. Accessing the card contents is another matter - but never mind, I only need the UID.
I looked around for existing Arduino code to access the reader and cards, and mostly I found variations of the same code:
- The "original" from Dr. Leong at B2CQSHOP with Chinese comments.
- A modified version from Grant Gibson.
- A library version from Miguel Balboa with Spanish comments.
None of these variants support cards with 7 and 10 byte UIDs (the most common is 4 bytes - or at least used to be. MIFARE Ultralight has 7 byte UIDs). Also the code does not support the anticollision protocol, ie it only works if there is only one card in the RF field (I might be wrong on this one, I have not studied the code enough to be certain).
Actually there is another piece of software: NXP has a Visual C++ project available for download (look for "200312"). After a cursory look I have decided to forget about NXP's code, and concentrate on the Arduino code from Miguel Balboa. I will translate the comments to English, clean up, and implement proper anticollision and support for 7 and 10 byte UIDs. All changes will be offered as a GitHub pull request to Miguel, but I do not yet know if he is interested. Stay tuned!
Subscribe to:
Posts (Atom)