Merge pull request #160 from Rotzbua/upd-readme
Upd readme & fix compile error Thank you @Rotzbua , Is very helpful, Happy new year to you.
This commit is contained in:
76
MFRC522.cpp
76
MFRC522.cpp
@@ -1110,6 +1110,49 @@ MFRC522::StatusCode MFRC522::MIFARE_SetValue(byte blockAddr, long value) {
|
|||||||
return MIFARE_Write(blockAddr, buffer, 16);
|
return MIFARE_Write(blockAddr, buffer, 16);
|
||||||
} // End MIFARE_SetValue()
|
} // End MIFARE_SetValue()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Authenticate with a NTAG216.
|
||||||
|
*
|
||||||
|
* Only for NTAG216. First implemented by Gargantuanman.
|
||||||
|
*
|
||||||
|
* @param[in] passWord password.
|
||||||
|
* @param[in] pACK result success???.
|
||||||
|
* @return STATUS_OK on success, STATUS_??? otherwise.
|
||||||
|
*/
|
||||||
|
MFRC522::StatusCode MFRC522::PCD_NTAG216_AUTH(byte* passWord, byte pACK[]) //Authenticate with 32bit password
|
||||||
|
{
|
||||||
|
MFRC522::StatusCode result;
|
||||||
|
byte cmdBuffer[18]; // We need room for 16 bytes data and 2 bytes CRC_A.
|
||||||
|
|
||||||
|
cmdBuffer[0] = 0x1B; //Comando de autentificacion
|
||||||
|
|
||||||
|
for (byte i = 0; i<4; i++)
|
||||||
|
cmdBuffer[i+1] = passWord[i];
|
||||||
|
|
||||||
|
result = PCD_CalculateCRC(cmdBuffer, 5, &cmdBuffer[5]);
|
||||||
|
|
||||||
|
if (result!=STATUS_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Transceive the data, store the reply in cmdBuffer[]
|
||||||
|
byte waitIRq = 0x30; // RxIRq and IdleIRq
|
||||||
|
byte cmdBufferSize = sizeof(cmdBuffer);
|
||||||
|
byte validBits = 0;
|
||||||
|
byte rxlength = 5;
|
||||||
|
result = PCD_CommunicateWithPICC(PCD_Transceive, waitIRq, cmdBuffer, 7, cmdBuffer, &rxlength, &validBits);
|
||||||
|
|
||||||
|
pACK[0] = cmdBuffer[0];
|
||||||
|
pACK[1] = cmdBuffer[1];
|
||||||
|
|
||||||
|
if (result!=STATUS_OK) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_OK;
|
||||||
|
} // End PCD_NTAG216_AUTH()
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Support functions
|
// Support functions
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1768,36 +1811,3 @@ bool MFRC522::PICC_ReadCardSerial() {
|
|||||||
byte result = PICC_Select(&uid);
|
byte result = PICC_Select(&uid);
|
||||||
return (result == STATUS_OK);
|
return (result == STATUS_OK);
|
||||||
} // End
|
} // End
|
||||||
|
|
||||||
PICC_ReadCardSerial()MFRC522::StatusCode MFRC522::PCD_NTAG216_AUTH(byte *passWord, byte pACK[]) //Authenticate with 32bit password
|
|
||||||
{
|
|
||||||
MFRC522::StatusCode result;
|
|
||||||
byte cmdBuffer[18]; // We need room for 16 bytes data and 2 bytes CRC_A.
|
|
||||||
|
|
||||||
cmdBuffer[0] = 0x1B; //Comando de autentificacion
|
|
||||||
|
|
||||||
for(byte i = 0; i < 4; i++)
|
|
||||||
cmdBuffer[i + 1] = passWord[i];
|
|
||||||
|
|
||||||
result = PCD_CalculateCRC(cmdBuffer, 5, &cmdBuffer[5]);
|
|
||||||
|
|
||||||
if (result != STATUS_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Transceive the data, store the reply in cmdBuffer[]
|
|
||||||
byte waitIRq = 0x30; // RxIRq and IdleIRq
|
|
||||||
byte cmdBufferSize = sizeof(cmdBuffer);
|
|
||||||
byte validBits = 0;
|
|
||||||
byte rxlength = 5;
|
|
||||||
result = PCD_CommunicateWithPICC(PCD_Transceive, waitIRq, cmdBuffer, 7, cmdBuffer, &rxlength, &validBits);
|
|
||||||
|
|
||||||
pACK[0] = cmdBuffer[0];
|
|
||||||
pACK[1] = cmdBuffer[1];
|
|
||||||
|
|
||||||
if (result != STATUS_OK) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -374,7 +374,6 @@ public:
|
|||||||
MFRC522::StatusCode MIFARE_SetValue(byte blockAddr, long value);
|
MFRC522::StatusCode MIFARE_SetValue(byte blockAddr, long value);
|
||||||
MFRC522::StatusCode PCD_NTAG216_AUTH(byte *passWord, byte pACK[]);
|
MFRC522::StatusCode PCD_NTAG216_AUTH(byte *passWord, byte pACK[]);
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
// Support functions
|
// Support functions
|
||||||
/////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
17
README.rst
17
README.rst
@@ -74,6 +74,7 @@ There are three hardware components involved:
|
|||||||
* One or two might be included with the Reader or *"starter kit"* already.
|
* One or two might be included with the Reader or *"starter kit"* already.
|
||||||
|
|
||||||
|
|
||||||
|
.. _protocol:
|
||||||
Protocols
|
Protocols
|
||||||
---------
|
---------
|
||||||
|
|
||||||
@@ -95,6 +96,14 @@ Protocols
|
|||||||
* The reader do not support ISO/IEC 14443-3 Type B.
|
* The reader do not support ISO/IEC 14443-3 Type B.
|
||||||
|
|
||||||
|
|
||||||
|
.. _security:
|
||||||
|
Security
|
||||||
|
-------
|
||||||
|
This library only supports crypto1-encrypted communication. Crypto1 is for a few years `broken`_. So it do NOT offer ANY security, it is like a unencrypted communication. **Do not use it for any security related application!**
|
||||||
|
This library do not offer 3DES or AES authentification used by e.g. Mifare DESFire, maybe it can be implemented because the datasheet says there ist a support. We hope for pull requests :).
|
||||||
|
|
||||||
|
|
||||||
|
.. _troubleshooting:
|
||||||
Troubleshooting
|
Troubleshooting
|
||||||
-------
|
-------
|
||||||
|
|
||||||
@@ -103,6 +112,7 @@ Troubleshooting
|
|||||||
#. Check your connection, see `Pin Layout`_ .
|
#. Check your connection, see `Pin Layout`_ .
|
||||||
#. Check voltage. Most breakouts work with 3.3V.
|
#. Check voltage. Most breakouts work with 3.3V.
|
||||||
#. The SPI only works with 3.3V, most breakouts seems 5V tollerant, but try a level shifter.
|
#. The SPI only works with 3.3V, most breakouts seems 5V tollerant, but try a level shifter.
|
||||||
|
#. According to reports #101, #126, #131 there are maybe a problem with the soldering on the MFRC522 breakout. You maybe can fix it by your own.
|
||||||
|
|
||||||
|
|
||||||
* **Sometimes I get timeouts** or **tag/card sometimes not work.**
|
* **Sometimes I get timeouts** or **tag/card sometimes not work.**
|
||||||
@@ -121,6 +131,7 @@ Troubleshooting
|
|||||||
#. NFC tokens are not supported. Some may work.
|
#. NFC tokens are not supported. Some may work.
|
||||||
#. Animal marker are not supported. They use other frequency.
|
#. Animal marker are not supported. They use other frequency.
|
||||||
#. Hardware corrupted, most products are from china and sometimes the quality is really low. Contact your seller.
|
#. Hardware corrupted, most products are from china and sometimes the quality is really low. Contact your seller.
|
||||||
|
#. Newer versions of Mifare cards like DESFire/Ultralight maybe not work according to missing authentification, see `security`_ or different `protocol`_.
|
||||||
|
|
||||||
* **My mobile phone doesn't recognize the MFRC522** or **my MFRC522 can't read data from other MFRC522**
|
* **My mobile phone doesn't recognize the MFRC522** or **my MFRC522 can't read data from other MFRC522**
|
||||||
|
|
||||||
@@ -128,6 +139,7 @@ Troubleshooting
|
|||||||
#. Communication with mobile phones is not supported.
|
#. Communication with mobile phones is not supported.
|
||||||
#. Peer to peer communication is not supported.
|
#. Peer to peer communication is not supported.
|
||||||
|
|
||||||
|
|
||||||
* **I need more features.**
|
* **I need more features.**
|
||||||
|
|
||||||
#. If software: code it and make a pull request.
|
#. If software: code it and make a pull request.
|
||||||
@@ -175,8 +187,9 @@ by Søren Thing Andersen (from http://access.thing.dk).
|
|||||||
It has been extended with functionality to alter sector 0 on Chinese UID changeable MIFARE card in Oct 2014 by Tom Clement (from http://tomclement.nl).
|
It has been extended with functionality to alter sector 0 on Chinese UID changeable MIFARE card in Oct 2014 by Tom Clement (from http://tomclement.nl).
|
||||||
|
|
||||||
|
|
||||||
.. _arduino: http://arduino.cc/
|
.. _arduino: https://arduino.cc/
|
||||||
.. _ebay: http://www.ebay.com/
|
.. _ebay: http://www.ebay.com/
|
||||||
.. _iso/iec 14443a: http://en.wikipedia.org/wiki/ISO/IEC_14443
|
.. _iso/iec 14443a: https://en.wikipedia.org/wiki/ISO/IEC_14443
|
||||||
.. _iso/iec 14443-3\:2011 part 3:
|
.. _iso/iec 14443-3\:2011 part 3:
|
||||||
.. _nxp mfrc522: http://www.nxp.com/documents/data_sheet/MFRC522.pdf
|
.. _nxp mfrc522: http://www.nxp.com/documents/data_sheet/MFRC522.pdf
|
||||||
|
.. _broken: http://eprint.iacr.org/2008/166
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ void loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
byte PSWBuff[] = {0xFF, 0xFF, 0xFF, 0xFF}; //32 bit PassWord default FFFFFFFF
|
byte PSWBuff[] = {0xFF, 0xFF, 0xFF, 0xFF}; //32 bit PassWord default FFFFFFFF
|
||||||
byte pACK[] = {0, 0}; //16 bit PassWord ACK returned by the NFCtag
|
byte pACK[] = {0, 0}; //16 bit PassWord ACK returned by the NFCtag
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
name=MFRC522
|
name=MFRC522
|
||||||
#date as version - no leading zero
|
version=1.1.2
|
||||||
version=2015.9.4
|
|
||||||
author=GithubCommunity
|
author=GithubCommunity
|
||||||
maintainer=miguelbalboa
|
maintainer=miguelbalboa
|
||||||
sentence=Arduino RFID Library for MFRC522 (SPI)
|
sentence=Arduino RFID Library for MFRC522 (SPI)
|
||||||
paragraph=Read/Write a RFID Card or Tag using the ISO/IEC 14443A/MIFARE interface.
|
paragraph=Read/Write a RFID Card or Tag using the ISO/IEC 14443A/MIFARE interface.
|
||||||
category=Communication
|
category=Communication
|
||||||
url=https://github.com/miguelbalboa/rfid
|
url=https://github.com/miguelbalboa/rfid
|
||||||
architectures=avr,STM32F1
|
architectures=avr,STM32F1,teensy
|
||||||
|
|||||||
Reference in New Issue
Block a user