Get-To-Byte

MFRC522 RFID module interfacing with Host MCU

Many of you may be familiar with the RFID module MFRC522, but I’m willing to bet that most of you have only interfaced this module with an Arduino and the Arduino IDE environment. However, if you need to use the RFID module with other MCUs, you may find yourself at a loss for how to proceed. If this is the case, you’ve come to the right place. In this blog, I will show you how to create a device driver for the RFID Module MFRC522, allowing you to interface it with any Host MCU. If you’re not sure what we mean by interfacing with a Host MCU or why it’s necessary, be sure to check out our blog for more information.

Continuing with the MFRC522 RFID reader interfacing to host MCU, Objective would be to interface this module with Host MCU’s like of NXP Semiconductors, STMicroelectronics or other vendors MCU’s. Will make the driver to interface the RFID Reader with any MCU, not unlike just with Arduino and Arduino IDE environment. You just need to change 2-3 low level API’s for running it on different MCU’s, would be telling about it in below sections. In this blog we are going to write the driver in c++ language. Before proceeding further would recommend viewers go through, the following set of blogs and videos to have a better understanding.

 Viewers can refer to this blog to know about RFID technology in detail.

or can watch this video which is in animated format to know about RFID technology.

RFID Reader MFRC522: Overview and Datasheet Explanation( Highly recommended to go through at first)

RFID Reader MFRC522

MIFRAME RFID Tags: Overview and Datasheet Explanation

Hardware Connection of MFRC522 Reader module

MFRC522 Module has 8 pins exposed out, which can be categorised into 3 parts: Communication pins, Power Supply Pins and Additional Pins. As explained below

MFRC522 Pinout

MFRC522 Functional Description API's

MFRC522 has a set of functional descriptions, on which the whole of the working of MFRC522 depends. To write the driver of MFRC522, it’s important to have an understanding of those functional blocks. Reading from the datasheet could be tiering, hence viewers can read and understand from here.

MFRC522 State Machines

State Machines for doing various operations with MFRC522.

In this would talk about different state machines for the working of MFRC522.

  1. MFRC522 init state machine
  2. MFRC522 scanning PICC state machine
  3. MFRC522 Get UID PICC state machine.
  4. MFRC522 CRC

Driver creation of MFRC522 Reader

GB_MFRC522.h

GB_MFRC522.c

Proposed Demo

STM32F103
NXP S32K144
AVR MCU

Project Download

Leave a Comment

Scroll to Top