PN512 getting started

Forum / MIFARE and NFC Reader IC`s / PN512 getting started

Tagged: 

  • 22. March 2016 at 11:01
    Hi all,

    I got myself an EXPLORE evaluation board to get started with the PN512. My goal is to use the PN512 for several types of Mifare cards (using 1 and 3 step anticolission loop) and retreive the cards UID. This all using my own MCU controlling the PN512.

    I have found the NFC reader library with example code, but it is too comprehensive for me to actually get a good idea what steps need to be taken and what parts to configure. The information stays too abstact to get a good picture. Is there a somewhat more simpler example code available, not using several layers?

    For example: accoring to the datasheet the PN512 should be configures with the CONFIG command, sending 25 bytes to fifo... and so. NFCID1, NFCID2 and NFCID3 are required for this. So there is a 10-byte NFCID split up in three parts? But how to choose this NFCID? Is it related to the type of Mifare cards I want to use or is it related with specific cards that are allowed to be authorized? And an 8 byte PAD and a 2 byte System Code is mentioned, but also here I don't understand how to choose this. Maybe I should be able to find this from the example code from the NFC reader library, but I can't Sad

    All explanation or help is much appreciated!

    Joris

    + 0  |  - 0

    Re: PN512 getting started

    22. March 2016 at 12:44
    Hi Joris,

    I understand your point of view. The NxpReaderLib is designed for several platforms and different use-cases and therefore it is a little bit oversized. It would be nice to have a small Linux driver which supports the IFDHandlers for the pcsc-lite library. With this approach you are (almost) compatible with the PC/SC interface and you can port the software easily to another NFC controller (which is supported by pcsc-lite) or even to a PC. Unfortunately we do not have such driver.

    All what I can support is PN512 reading/writing sequences you have to use for the different tasks. For each task (card detection, select, authenticate etc.) you have to fulfill writing and reading PN512 registers. You implement this via SPI reading and writing sequences. The “blue board” is connected via SPI with the Pi.

    Kind regards,
    The MIFARE Team
    + 0  |  - 0

    Re: PN512 getting started

    22. March 2016 at 13:57
    Thank you for your quick reply. Too bad about the drivers but I expected this so I'll try to find out about all without drivers :)

    Can you do clarify what I asked about the config command of the PN512? Or should I go to a different forum for this? I believe this is the first step towards enabling the RF field and sending a REQA. So clarification about my question about the NFCID, PAD and System Code.

    Thank you. Joris

    + 0  |  - 0

    Re: PN512 getting started

    22. March 2016 at 14:09
    Hi Joris,

    You should get familiar with the SPI (Serial Port Interface) on the Pi. The NFC Controller board is connected via SPI to the Pi. You will find a lot of information in the net if you enter “raspberry pi spi” into your favorite search engine.

    If you are able to send data to the spi device (in Linux notation: /dev/spidev0.0) you can program the PN512 directly. The next step is to write and read PN215 registers.

    The MIFARE Team
    + 0  |  - 0

    Re: PN512 getting started

    22. March 2016 at 14:59
    Ow yes with this first step I succeeded. I am able to do the Selftest (softreset, write to fifo, send command, read from fifo).

    From the datasheet I understood that to configure the PN512 for automatic Mifare anticollission, I should send 25 bytes (amongst which the NFCID, PAD and System Code) to the FIFO and send a config command to the command register. Since anticollission is nescessary for communication I also thought that the automatic Mifare anticollossion settings is obligated and the first step towards communication. Are these assumptions ok?

    Anwayway, what would be the first steps (registers to attend to) to start the card detection (setup RF field, send REQA, ..)? I understand you can't tell me for each register what to write for my specific solution.

    Thanks. Joris
    + 0  |  - 0

    Re: PN512 getting started

    22. March 2016 at 15:52
    Hi Joris,

    I can provide you with the register sequences you have to implement.

    It is too elaborated for a forum post. Please write me at: mifaresdk@nxp.com

    The MIFARE Team

    + 0  |  - 0

    Re: PN512 getting started

    31. March 2016 at 12:12
    Dear Mifare team,

    Even though I was not able to use the automatic anticolission feature on the PN512, I was able to do it manually with the information you send me.

    Thanks, Joris

    + 0  |  - 0
Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.