0
\$\begingroup\$

For my school project I'm using the MFRC522 card reader and an FPGA with VHDL. I'm using SPI lines but I can't understand how am I supposed create a communication with it.

From what I've understand so far I have to sycnhronize both with the same clock (which I did and checked). Then... I don't know, am I supposed to send an address every time to get card information?

Isn't the card reader supposed to send me the information stored in the card when it reads it?

What do I have to do to get the card reading?

If I have to send an address every time, what address do I have to send? I've checked registers but I couldn't make sense of any of them.

\$\endgroup\$
  • \$\begingroup\$ Google search for MFRC522 application note site:nxp.com leads to Design Support tab, NXP Reader Library version 2.1 with Visual C++ project: nxp.com/documents/software/200312.zip \$\endgroup\$ – MarkU Dec 16 '14 at 3:16
1
\$\begingroup\$

I'm not sure what you are expecting, but you should realize that you need quite a lot of software to read RF cards with these chips. I've done it and it took several days of coding. Luckily, as pointed out by @MarkU, there's a lot of example code floating around in the web. There's these nxp examples (http://nxp.com/documents/software/200312.zip) (which I looked at but ended up writing the code from scratch). And there's now an Arduino library, which could be helpful also.

In case it's your impression, it's not just a matter of pulling low a chip select and clocking in the data from the card. First you need to take control of the MFRC522 chip so that you know how to send data packets to the air with the correct baudrate, format and RF protocol for the RF card you're reading. I ended up winding a 5 centimeter coil with a few loops and connected it to an oscilloscope probe to be able to measure the RF signal, and eventually snoop the traffic between the reader and the card, just to see if the card seemed to be doing anything at all. (For those interested, I also rectified it with a diode and filtered with a small capacitor to get a functional trigger signal for the scope and it was really helpful).

Once you have the MFRC522 under control, you must support the higher-level RF protocol to select the RFID card and read data from it. That's not a trivial task, either. But of course, the now existing example codes help.

You didn't say that you had a microcontroller in your system or that you're using a soft CPU core in your FPGA. I'm asking this, because writing the control code in VHDL would be very very tricky. I'm not saying that it's impossible, but you should have a working software implementation first.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer! I don't know what you mean by soft "CPU core", all I know about my FPGA is that it is Digilent Basys 2, and it says Spartan 3E-100 CP132 on the back of the box. \$\endgroup\$ – bobku123 Dec 16 '14 at 10:31
  • \$\begingroup\$ Hi! A soft CPU core is a processor that you can implement inside the FPGA. The 3E-100 is quite small FPGA, but at least the Xilinx's PicoBlaze processor fits inside it. You could put that CPU into your design and control the SPI with PicoBlaze. You then could write the control code for the RF chip in PicoBlaze assembly language. It has a 1K maximum size for programs, which might just be enough to control the RF chip. But be warned: this is quite challenging design, even most professionals would need a significant amount of time to make the design. \$\endgroup\$ – PkP Dec 16 '14 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.