Mifare Ultralight C with NFC Shield V1.0

Hi,

I recently got a NFC shield V1.0 from Seedstudio. I’m super happy with the wiki (seeedstudio.com/wiki/index.p … NFC_Shield); however, I am unable to read/write to my Mifare Ultralight C NFC stickers. It seems that nfc.authenticateBlock fails for me. The NFC shield successfully picks up the ID of each ultralight C but it then does not succeed in reading or writing to any given block on the tag.

Here is the line that I think may be of trouble. Any thought on what I may be doing wrong?

uint8_t keys[]= {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};  // default key of a fresh card


        if(nfc.authenticateBlock( 1 /*1 or 2*/,
                 id /*Card NUID*/,
                 10/*0 to 63*/,
                 KEY_A /*Either KEY_A or KEY_B */,
                 keys)) { ...}

I am also including my entire code for more detail. Please let me know if you need more information. Thanks!



#include "PN532.h"

#define SCK 13
#define MOSI 11
#define SS 10
#define MISO 12

PN532 nfc(SCK, MISO, MOSI, SS);

void setup(void) {
    Serial.begin(9600);
    Serial.println("Hello!");

    nfc.begin();

    uint32_t versiondata = nfc.getFirmwareVersion();
    if (! versiondata) {
        Serial.print("Didn't find PN53x board");
        while (1); // halt
    }
    // Got ok data, print it out!
    Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX);
    Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC);
    Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
    Serial.print("Supports "); Serial.println(versiondata & 0xFF, HEX);

    // configure board to read RFID tags and cards
    nfc.SAMConfig();
}


void loop(void) {
    uint32_t id;
    // look for MiFare type cards
    id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);

    if (id != 0)
    {
        Serial.print("Read card #");
        Serial.println(id);
        Serial.println();
        uint8_t keys[]= {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};  // default key of a fresh card


        if(nfc.authenticateBlock( 1 /*1 or 2*/,
                 id /*Card NUID*/,
                 10/*0 to 63*/,
                 KEY_A /*Either KEY_A or KEY_B */,
                 keys)) 
        {
            Serial.println("authenticated!");
        }
        else {
            Serial.println("failed to authenticate");
        }
        

    }
    delay(2000);
}




I try the code you are posting,It can work succeed.So your code is OK.
I think is the Card problem or you can try to put the card on the NFC shield for a little long time.(do not take it away so quick)

Hi!

Thank you for your response.

Did you try a MIFARE UltralightC chip? Because so far, still no luck, even when I keep the chip on the reader for a while.

I also tried other ultralightC chip and the problem is the same.

Hi,
For this card [http://www.seeedstudio.com/depot/1356mhz-rfid-book-tag-p-1067.html?cPath=144_153],is just for read the card number,it can not read or write the memoryblocks.
If you wan to Read&write the card,you can buy this:http://www.seeedstudio.com/depot/mifareone-rfid-card-1356mhz-p-240.html?cPath=144_153

Ah excellent! Thank you so much for clarifying things up for me!!

(by the way, the wiki might need some updating to specify the point regarding not being able to read/write ultralightC, despite being able to read the UID of the ultralightC chip.)

wiki: seeedstudio.com/wiki/index.p … NFC_Shield

thank you again!

Ok!
Thank you too.