mxgxw / MFRC522-python

A small class to interface with the NFC reader Module MFRC522
GNU Lesser General Public License v3.0
521 stars 419 forks source link

Authentication Error with NTAG216 #24

Open domschiener opened 8 years ago

domschiener commented 8 years ago

Was able to setup the RC522 and get it running with the card and tag that came shipped with it. I tried reading my other NFC sticker tags (NTAG216), and I keep getting authentication errors:

AUTH ERROR!!
AUTH ERROR(status2reg & 0x08) != 0
Authentication error

Anyone have an idea on how to fix this?

Cotix commented 8 years ago

I wrote that code a pretty long time ago, and it is pretty much what it says it is.. An authentication error. I am not familiar with NTAG216, but either your supplied key is wrong(you need to supply a key to access a block, default key is [0xFF]*6, but this might differ on your chip), or NTAG216 does not use the same MFRC522 protocol.

The 4th bit of status2reg equals 1, which is somekind of error flag. I dont know from the top of my head what error that bit significes, but I'm guessing wrong password. If you want to debug this, I'd start by googling the documentation and finding out what that bit means.

EDIT: Have you seen this? https://github.com/mj3052/MFRC522-Pi

Liriel commented 7 years ago

came across this issue with NDEF tags there are a bunch of Default Keys that you should try...

found mine by trying each key for sectors 3 - 15 :)

TheRealBanana commented 7 years ago

Also having the same issue. I've tried all the common auth keys as well as all the different forks out there of this library with no success. I have at least verified that the MFRC522 can for sure read the NTAG213 and NTAG216 rfid tags using the arduino MRFC522 library. Maybe comparing the way that library works vs this one would help.

I've forked the repo and made some changes that get basic reading/writing for NTAG213/215/216 tags. Its very hacky and could be improved but it is a proof of concept. The problem was the NTAG213/215/216 don't require an explicit authentication key to read from their pages like the MIFARE Classic 1k does, for example. Bypassing the authentication part of the read and write scripts was sufficient to fix the issue.

soporteHW commented 6 years ago

Also having same issue. I use this library: https://stm32f4-discovery.net/2014/07/library-23-read-rfid-tag-mfrc522-stm32f4xx-devices/

When I try to authenticate my mifare card using MFRC422_Auth(*) functions, It returns error -> the MFRC522_REG_STATUS2 is always 0 value. In my case, I want to read bolck 3, sector 16 with key FFFFFFFF. The call function is as follows:

_statusRFID = TM_MFRC522_Auth(0x60,63, RFIDKEY, CardID)

This returns statusRFID = MIOK; but later when I call readRegister(MFRC522_REG_STATUS2) & 0x08)_ , statusRFID turns MI_ERR.

Why?