Strange Ntag216 behavior when read by RC522
Posted: Fri Jan 19, 2018 5:08 am
Hey my first post is already about a very strange and special case - sorry in advanced:
So, I wrote my own small "Open my door" sketch, and it runs perfectly in my test cases. But as I wan't to put some Ntag216 tags in my all of my right shoes and being able to open the door with a reader underneath the stairs at the entrance, I discovered a strange thing:
When the tags are virginius they can be read without problems (of course rejected from the sketch). When the tag is prepaired:
it will only be recognized (and authenticated so everything works fine) from the reader WHEN I TOUCH THE TAG SOMEWERE. This is so strange for me, that I uploaded a video so that you will hopefully belive me
https://www.youtube.com/watch?v=BG03GdWaC9o
BTW: I tested this with two RC522 reader and two Ntag216 tags!
So, I wrote my own small "Open my door" sketch, and it runs perfectly in my test cases. But as I wan't to put some Ntag216 tags in my all of my right shoes and being able to open the door with a reader underneath the stairs at the entrance, I discovered a strange thing:
When the tags are virginius they can be read without problems (of course rejected from the sketch). When the tag is prepaired:
Code: Select all
int NTAG216_make_key() {
int status = -1;
byte pACK[] = {0, 0}; //16 bit PassWord ACK returned by the NFCtag
byte PSWBuff[] = {0xFF, 0xFF, 0xFF, 0xFF}; // Standard NFC Tag Password
mfrc522.PCD_NTAG216_AUTH(&PSWBuff[0], pACK); // Auth Tag to make it writeable
// Modify Tag to be a valid key
byte WBuff_224[] = {0x00, 0x01, 0x01, 0x01}; // Write the ID house / apartment / keynumber
byte WBuff_225[] = {0xC1, 0x00, 0x00, 0xC1}; // Write the Main "Auth Password"
// 226 Part of Ntag216 dynamic lock bytes RFUI
byte WBuff_227[] = {0x00, 0x00, 0x00, 0xC8}; // OxC8 = Read/WriteProtect from Page 200. Be nice and leve some place :)
byte WBuff_228[] = {0x80, 0x05, 0x00, 0x00}; // Ox80 = 10000000 Read/WriteProtect activate
byte WBuff_229[] = {0x03, 0x00, 0xFE, 0x00}; // Set password
byte WBuff_230[] = {0x4f, 0x6b, 0x00, 0x00}; // Set Ok as PACK = Password ACK
Serial.print("Change BLK 224 - 230 to make key: ");
status += Serial.println(mfrc522.MIFARE_Ultralight_Write(224, WBuff_224, 4)); //How to write to a page
status += Serial.println(mfrc522.MIFARE_Ultralight_Write(225, WBuff_225, 4)); //How to write to a page
// 226 Part of Ntag216 dynamic lock bytes RFUI
status += Serial.println(mfrc522.MIFARE_Ultralight_Write(227, WBuff_227, 4)); //How to write to a page
status += Serial.println(mfrc522.MIFARE_Ultralight_Write(228, WBuff_228, 4)); //How to write to a page
status += Serial.println(mfrc522.MIFARE_Ultralight_Write(229, WBuff_229, 4)); //How to write to a page
status += Serial.println(mfrc522.MIFARE_Ultralight_Write(230, WBuff_230, 4));
return status;
}
it will only be recognized (and authenticated so everything works fine) from the reader WHEN I TOUCH THE TAG SOMEWERE. This is so strange for me, that I uploaded a video so that you will hopefully belive me
https://www.youtube.com/watch?v=BG03GdWaC9o
BTW: I tested this with two RC522 reader and two Ntag216 tags!