Arduino NFC

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
snowlimit
 
Posts: 3
Joined: Tue Dec 25, 2012 9:18 pm

Arduino NFC

Post by snowlimit »

I've been looking all over the forums and can't really find a straight answer, after I set a tag (I used the mifare classic that came with the shield) using the arduino NFC, can it NOT be overwritten? If so, then darn because I wanted to see it work so I loaded up the default adafruit.com page on the card. I read that you can reset the keys and rewrite the blocks but that seems near impossible.

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: Arduino NFC

Post by ktownsend »

NDEF is not fully supported in the current libraries, and the existing NDEF code is really only a very basic example.

We have been discussing the idea of developping this code further, but developing a complete NDEF stack with message formatting, clearing, and formatting sectors, properly adjusting the MAD sector on the Mifare cards, reformatting cards, etc., is unfortunately a couple hundred hours of work to do and test properly.

The only well supported functionality is currently reading and writing to cards in classic Mifare format (not NDEF which is a much more complicated stack that sits on top of the Mifare Classic cards), which is basically similar to EEPROM.

You CAN however download an Android app called NXP TagWriter (I believe ... just search for NXP), which is capable of formatting cards, and doing some manipulation of the data I believe.

There is currently not fixed deadline for when we will be able to extended the NDEF code further, since we're still trying to find the best way to approach this with a sensible amount of development effort.

PS: You can still modify this sector as normal, but you will need to use different authentication keys. See the example code here showing the two types of authentication keys, one for NDEF and one for Mifare Classic in non-NDEF format. You can modify the sector contents by using the NDEF keys for the NDEF sector with Adafruit.com, or continue using all of the other sectors (2..15) with the Mifare Classic keys. This is why the warning is mentionned in the example, though :( ...

Code: Select all

// ***********************
// TODO: !!! IMPORTANT !!!
// ***********************
// Set this field depending on if this is an NDEF formatted card.  
// For a non-NDEF card (for example an unformatted Mifare Classic card), 
// set this to 0.  
//
// NDEF formatted cards use specific keys for authentication, and the
// authentication requests will fail if you use the default Mifare keys
// (0xFF 0xFF 0xFF 0xFF 0xFF 0xFF for both key a and key B).
//
// Note that you will no longer be able to authenticate non-NDEF blocks
// when using NDEF keys since they will not match what is being provided.
// Also, because key a changes in block 0 (the MAD Sector for NDEF
// records), NDEF formatted cards will no longer work in normal
// Mifare mode.  Cards should be treated as NDEF or not, and it's best
// not to mix them because key managed becomes complicated.
//
// Possible values:
//
// READ_AS_NDEF = 0    No NDEF Sectors ... use default Mifare Classic keys
// READ_AS_NDEF = 1    NDEF Formatted Card ... use NDEF keys (only NDEF blocks will authenticate!)
//
// For more information see: 
//
// http://www.ladyada.net/products/rfidnfc/mifare.html
// http://www.ladyada.net/products/rfidnfc/ndef.html

User avatar
snowlimit
 
Posts: 3
Joined: Tue Dec 25, 2012 9:18 pm

Re: Arduino NFC

Post by snowlimit »

Hey thanks for the reply! I had no idea what was going on or what NDEF was, should have read up a bit more my impression was I needed to format the first time using the card and didn't realize this semi locks up the card. I did do some interesting stuff with the NFC though if you look at the video I posted in another thread!

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”