diff --git a/examples/Ntag216_AUTH/Ntag216_AUTH.ino b/examples/Ntag216_AUTH/Ntag216_AUTH.ino index efdf9c7..fc9f22c 100644 --- a/examples/Ntag216_AUTH/Ntag216_AUTH.ino +++ b/examples/Ntag216_AUTH/Ntag216_AUTH.ino @@ -1,11 +1,11 @@ //This example show how you can get Authenticated by the NTAG213,215,216 by default the tags are unprotected in order to protect them we need to write 4 different values: -// Using mfrc522.MIFARE_Ultralight_Write(PageNum, Data, #Databytes)) +// Using mfrc522.MIFARE_Ultralight_Write(PageNum, Data, #Databytes)) //1.- we need to write the 32bit passWord to page 0xE5 !for ntag 213 and 215 page is different refer to nxp documentation! //2.- Now Write the 16 bits pACK to the page 0xE6 use the 2 high bytes like this: pACKH + pACKL + 00 + 00 after an authentication the tag will return this secret bytes //3.- Now we need to write the first page we want to protect this is a 1 byte data in page 0xE3 we need to write 00 + 00 + 00 + firstPage all pages after this one are write protected // Now WRITE protection is ACTIVATED so we need to get authenticated in order to write the last data //4.- Finally we need to write an access record in order to READ protect the card this step is optional only if you want to read protect also write 80 + 00 + 00 + 00 to 0xE4 -//After completeing all these steps you will nee to authentiate first in order to read or write ant page after the first page you selected to protect +//After completeing all these steps you will nee to authentiate first in order to read or write ant page after the first page you selected to protect //To disengage proection just write the page (0xE3) to 00 + 00 + 00 + FF that going to remove all protection //Made by GARGANTUA from RoboCreators.com & paradoxalabs.com @@ -36,24 +36,23 @@ void loop() { return; } + byte PSWBuff[] = {0xFF, 0xFF, 0xFF, 0xFF}; //32 bit PassWord default FFFFFFFF + byte pACK[] = {0, 0}; //16 bit PassWord ACK returned by the NFCtag -byte PSWBuff[]={0xFF,0xFF,0xFF,0xFF}; //32 bit PassWord default FFFFFFFF -byte pACK[]={0,0}; //16 bit PassWord ACK returned by the NFCtag + Serial.print("Auth: "); + Serial.println(mfrc522.PCD_NTAG216_AUTH(&PSWBuff[0], pACK)); //Request Authentification if return STATUS_OK we are good -Serial.print("Auth: "); -Serial.println(mfrc522.PCD_NTAG216_AUTH(&PSWBuff[0],pACK)); //Request Authentification if return STATUS_OK we are good + //Print PassWordACK + Serial.print(pACK[0], HEX); + Serial.println(pACK[1], HEX); -//Print PassWordACK -Serial.print(pACK[0],HEX); -Serial.println(pACK[1],HEX); + byte WBuff[] = {0x00, 0x00, 0x00, 0x04}; + byte RBuff[18]; -byte WBuff[] = {0x00,0x00,0x00,0x04}; -byte RBuff[18]; + //Serial.print("CHG BLK: "); + //Serial.println(mfrc522.MIFARE_Ultralight_Write(0xE3, WBuff, 4)); //How to write to a page -//Serial.print("CHG BLK: "); -//Serial.println(mfrc522.MIFARE_Ultralight_Write(0xE3, WBuff, 4)); //How to write to a page - -mfrc522.PICC_DumpMifareUltralightToSerial(); //This is a modifier dunp just cghange the for cicle to < 232 instead of < 16 in order to see all the pages on NTAG216 + mfrc522.PICC_DumpMifareUltralightToSerial(); //This is a modifier dunp just cghange the for cicle to < 232 instead of < 16 in order to see all the pages on NTAG216 -delay(3000); -} + delay(3000); +} \ No newline at end of file