Вопрос

i've bought a NFC shield v2.0 from seeedstudio for my arduino one board. I connect the shield to arduino, and on the breakboard i have two leds and one lcd, and they seem to work all fine. I've downloaded the official libraries (http://www.seeedstudio.com/wiki/File:PN532_SPI_V2.zip), and i tried to launch the sample readAllMemoryBlocks (as well as all the others examples...) and, when the program starts running, what i get is:

Found chip PN532, Firmware ver. 1.6, Supports 7

Very well....now, when i try to put in contact my tag (mifare 1k card, or nfc forum type 2 tag) i get

Found 1 tags, Sens Response: 0x4, Sel Response: 0x8, 0x94 0x6F 0xFB 0xA6, Read card #2490366886

where the number next to # is the id of the tag. Everything fine, unless that it doesn't read or write anything (no one of the example). After a little basic debugging i found out that the problem is with the function

nfc.authenticateBlock(1, id ,blockn,KEY_A,keys)

where blockn goes from 0 to 63, according to the cpp file of the library; in another example (readMemoryBlock), block is 0x08, as well as in the readMemoryBlock function it never returns true....so i tried to avoid the use of the function, and put a

nfc.readMemoryBlock(1,0x8,block)

but it also return always false...so it seems that the library itself is having problems in getting the communication work fine. An example code can be find here: https://github.com/5v3n/Seeedstudio-PN532-RFID-NFC-Shield/blob/master/examples/readAllMemoryBlocks/readAllMemoryBlocks.pde

Anyone does know what is happening? Do i have to install some kind of driver that i'm missing (don't think, but...)? Someone experienced with this shield? Just want to get, at least, samples to work...

Thanks in advance! :)

Ps: all the tags work fine, i can read write erase etc them all with my smartphone app...

EDIT: sorry for the little mistakes..

Это было полезно?

Решение

I've used a PN532 on different shield. You have to get the authenticateBlock() to succeed because the card will not read or write without that step.

You are likely formatting the tags by NDEF standards because you say you are reading with phone app. You don't show the value of the key. The standard key A's for the directory and data records are:

/**
 * @brief MAD directory standard key A
 */
uint8_t NdefReadWrite::keyDirA[6] = { 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5 };

/**
 * @brief NFC application standard key A
 */
uint8_t NdefReadWrite::keyAppA[6] = { 0xD3, 0xF7, 0xD3, 0xF7, 0xD3, 0xF7 };

The key A on every NDEF format tag will be those values. Are you using those keys?

Also, the keys are 6 bytes. What is the 8 in the authenticateBlock() call?

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top