NTAG213 - Authentication Error with Raspberry Pi MFRC522

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NTAG213 - Authentication Error with Raspberry Pi MFRC522

5,536 Views
icezman
Contributor I

Hello

I've been searching all over the internet and can't seem to find a clear answer, hoping someone can help out.

Components being used in the project:

  • Using Raspberry Pi (is preferred because this is an extension of an existing project and the Pi is available, the rest of the program runs on it + Gpio pins are available, as to not having to introduce another hardware part like an arduino). 
    Using the mfrc522 library 
  • Using the RFID reader/writer module (works with NFC) from RobotDyn (convenient 5V extra pin and smaller size) (see image below this)
    Example MFRC522 Reader writer pinout.png
  • Using "On-metal Round NFC Tags NTAG213 22mm" (see image)
    Anti Metal NTAG213.JPG

Problem to be solved:

  • Authentication error
    I need a way (in python preferably) to write code that authenticates (gives the correct key) and then makes it able to change the password.

Preferred workflow:

  • Ntag213 tags gets authenticated and given a password by us. (Initial registration).
    Python program for initial registration
  • Registered ntags will then be need to be able to mainly read and occasionally be overwritten with different data (Only some numbers for identification purposes in a database handled by other code on the raspberry pi)
    Python program for reading
    Python program for writing

Here is a dump of the NTAG213 (read by the RobotDyn MFRC522):

Datadump Ntag213.jpg

I've read in the documentation that the authentication is being checked on black 7? Is that right?

I just have no idea how to change this key it uses.

Example of error reading it:

Error reading.JPG

Example of error writing to it:

Error writing.JPG

Code example of writing script (basic one just for testing): (SimpleMFRC522 source: MFRC522-python/SimpleMFRC522.py at master · pimylifeup/MFRC522-python · GitHub )

#!/usr/bin/env python

import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522

reader = SimpleMFRC522()

try:
 text = input('New data:')
 print("Now place your tag to write")
 reader.write(text)
 print("Written")
finally:
 GPIO.cleanup()

I'm guessing I need to include code in my read/write and registration script to authenticate first (giving the auth key) and if necessary (during write/read) giving a password (after I've set a password during the registration step).

I just have no idea which values or in which way I should give the auth key in script.

If anybody can help in any way or point me in the right direction that'd be great!

0 Kudos
3 Replies

4,785 Views
Bikos
Contributor I

Did you get a solution ?

0 Kudos

4,816 Views
alex5
Contributor I

I have the same problem, did anyone find a solution?

0 Kudos

4,816 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Ice,

I'd recommend to follow the flow chart that is on page 8 of the User Manual for the NTAG 213. In the following pages the commands that should be used to appropriately enter the authenticated state are described.  Section 8.8 explains how to proceed in configuring the password itself and the commands to be used.

The commands themselves are also described in the same document. Unfortunately we do not have any example code made with python.  You can check the NFC Reader library that has examples created in C, it does use different modules but you may get a general idea of what needs to occur in order to properly read and write the Tag.

As an observation in your code, it does need more information so your tag properly receives the instructions in needs to access certain areas of the memory. As you mentioned yourself you need to include the part that authorizes the user. This you will find described in the flow chart I've mentioned above. 

Hope this helps,

Sabina

0 Kudos