RFID - Elektor
RFID - Elektor
RFID - Elektor
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
9<br />
<strong>Elektor</strong> <strong>RFID</strong><br />
Projects<br />
Gerhard H. Schalk<br />
9.1 Programming the MF RC522 Reader IC<br />
The MF RC522 reader IC is programmed and configured using a total of 48 special function<br />
registers (SFRs). A host computer can control the MF RC522 registers via RS-232,<br />
I 2 C or SPI interface. Selection of the serial interface is done with a voltage at the input<br />
pins I2C and EA (hardwired). In the <strong>Elektor</strong> <strong>RFID</strong> Reader (Figure 9.1), connection to the<br />
P89LPC396 microcontroller is done via I 2 C.<br />
copyright <strong>Elektor</strong><br />
Figure 9.1. <strong>Elektor</strong> <strong>RFID</strong> Reader simplified block diagram.<br />
The <strong>Elektor</strong> <strong>RFID</strong> Reader’s firmware, that is, the P89LPC936 microcontroller program,<br />
supports the two stand-alone modes of operation, Terminal mode and Access Control<br />
mode, as well as a PC Reader mode. For performance reasons, the complex MF RC522<br />
control software is implemented entirely in the reader firmware.<br />
In PC Reader mode, the communication with the card is always initiated by the PC. The<br />
PC sends a firmware command to the microcontroller via the FT232R USB-to-RS-232<br />
converter. This calls the corresponding MF RC522 function. The MF RC522 registers are<br />
read and written via I 2 C. Writing and reading of card data always takes place through<br />
the 64-byte FIFO (first-in-first-out) buffer. By repeatedly writing to or reading from FI-<br />
FODataReg, data is transferred to or from the FIFO buffer. The generation of protocol<br />
frames, including CRC calculation, is carried out entirely by the contactless UART. RF<br />
modulation of the serial bit stream ultimately takes place in the analog interface. The<br />
demodulation and decoding of the card’s response also takes place in the analog sec-<br />
385