NFC/RFID Sensors and Modules

So, hello to all viewers and welcome back to Gettobyte Platform. In This blog you are going to know about RFID Reader MFRC522, which is designed by NXP Semiconductors. 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. To make the driver of RFID reader at first, we need to dig into its datasheet, to understand its various sub parts. And that’s all about this blog is gotten going to be, to make the datasheet understand in easy way-out.

MFRC522 Datasheet Explanation

Table of Contents

Next & Previous Blog

RFID Technology

RFID modules is a wireless sensing technology which is used to track/identify/monitor the objects.

 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.

MFRC522 RFID Reader/PCD

MFRC522 is a highly integrated reader/writer IC for contactless communication at 13.56 MHz. These reader supports the ISO 14443 A protocol for communicating with RFID Tags. They are used to detect the MIFRAME RFID tags.

MFRC522 IC

MFRC522 has internal RF transceiver, which provides a robust and efficient implementation for demodulating and decoding signals from MIFRAME compatible cards using ISO 14443 A protocol. The digital module of MFRC522 manages the complete ISO/IEC 14443 A framing and error detection (parity and CRC) functionality.

MFRC522 supports 3 tags of MIFRAME family, that are MF1xxS20, MF1xxS70 and MF1S50 products.

MFRC522 features

MFRC522 Features

MFRC522 though quite old RFID reader and in today’s time many new advance RFID readers have come up. But so as to get started with this technology as a hobbyist/student/DIY project, it is perfect module to lay your hands on this Technology.

  • MFRC522 has highly integrated analog circuitry to demodulate and decode responses when RFID tags are brought in close proximity of these devices.
  • RFID readers are connected with some host MCU, where the processing of data which is received via RFID tags happens according to the application. MFRC522 can connect with host MCU, using SPI, Serial UART and I2C -bus interface.
  • It supports ISO 14443 A protocol and can be used with MIFRAME family of RFID tags. And in MIFRAME family it supports only MF1xxS20, MF1xxS70 and MF1xxS50 products.
  • It has internal CRC-coprocessor.
  • Internal FIFO buffer which can handle 64 bytes of sending and receiving.
  • It uses the Crypto-1 cipher for authenticating.
  • It supports Internal oscillator for connection to 27.12 MHz quartz crytsal.
  • It is low power device, need 2.5 V to 3.3 V power supply.
  • It also has flexible interrupt modes when some RFID tags are detected and trigering events too. In addition to flexible interrupt, it has programmabe I/O pins and timer.
  • It can perform Internal self-test too.

MFRC522 Functional description

MFRC522 Functional Descriptions

MFRC522 Block Diagram

MFRC522 Block Diagram

Above is the simplified block diagram of MFRC522 module. MFRC522 has an internal memory, power supply, interrupt pins, FIFO buffer, Antenna and analog interface, digital module for communicating with Host MCU. 

Analog Interface handles the modulation and demodulation of the analog signals. FIFO Buffer ensures fast and convenient data transfer.

Register bank are the set of registers through which MFRC522 would be configured and initialized to use. Parameters like Clock, Interrupts, status of errors while communicating with RFID readers, CRC calculation, FIFO configuration and etc need to be configured before using the MFRC522.

How the MFRC522 Internal system works?

Host MCU will send PCD Commands to MFRC522, according to which it will perform some operations. MCU will send these commands by writing into one of the registers of PCD.( For MFRC522 CommandReg is register)

Operations like: 

  • Activation of CRC Coprocessor
  • Transmission of data from FIFO buffer of MFRC522 and activation of receiver circuits to get the response from PICC
  • transfer of data from FIFO to an internal buffer 
  • soft reset and authentication-based operations

Further MFRC522 will emit the commands for communicating with PICC, here referred to as PICC Commands, according to which operation with PICC takes place, like scanning of PICC, selecting the PICC, reading and writing the data on PICC. MFRC522 emits these commands via electromagnetic induction and electric coupling. ( That is the main working principle behind the RFID technology)

Host MCU to PCD

Host MCU will send the commands to PCD, according to which PCD will perform the operations like activation of FIFO buffer or CRC coprocessor, and transmission of data from FIFO. We will name these commands as MFRC522 Commands sets. Host MCU will send those commands to PCD (here MFRC522) by writing into the CommandReg Register using low level Host Interface write API.

  • Idle Command: Places the MFRC522 in Idle mode.
  • Mem Command: Transfers the 25 bytes from the FIFO Buffer to the internal buffer. This command is used when, we want to read the data from PICC( As described in ISO-14443-4 doc), as PICC response is always recorded in PCD FIFO.
  • Generate RandomID: generates a 10-byte random ID number.
  • CalcCRC: Activates the CRC coprocessor or performs a self test.
  • Transmit: transmit data from the FIFO buffer
  • NoCmdChange: no command change, can be used to modify the CommandRef register bits without affecting the command
  • Receive: activates the receiver circuits
  • Transceive: Transmit data from the FIFO buffer to antenna and automatically activates the receiver after transmission.
  • MFAuthent: performs the MIFARE standard authentication as a reader
  • SoftReset: This command performs a reset of the device. The configuration data of the internal buffer remains unchanged. All registers are set to the reset values. This command automatically terminates when finished.

PCD to PICC

Further there are also command set which PCD have to emit to communicate with PICC and enter the PICC into some state machine.

PICC States:

  1. Power-off State: In the POWER-OFF state, the PICC is not powered by a PCD operating field
  2. Idle State: In the IDLE state, the PICC is powered. It listens for commands and shall recognize REQA and WUPA commands. 
  3. Ready State: Cascade levels are handled inside this state to get the complete UID. PICC enters the ACTIVE state when it is selected with its complete UID.
  4. Active State: PICC complies with ISO-14443-4 to accept protocol activation commands (RATS)
  5. HALT State: In this state PICC only responds to WUPA command.
  6. Protocol State: PICC behaves according to 1s014443-4 specifications.

We will name these commands as PICC commands. Host MCU will write these PICC command into the PCD FIFO (refer the MFRC522 FIFO section on how to write the data on FIFO). PCD would transmit the FIFO data when it enters the Transceiver state machine (refer above topic).

PCD would transmit these commands via the electromagnetic induction and communicates with PICC via electronic coupling. PCD’s have RF transceivers through which it emits the electromagnetic waves with commands sets encoded in them. PICC have antenna and small circuitry, which gets energized via electromagnetic waves emitted by PCD and then further both PCD and PICC get coupled together to have 2 way wireless communication. How PCD would send commands to PICC and in return how PICC would respond, that is done according to IS014443 protocol. ISO14443 specifies all the frame formats,PICC command  and their format ,  modulation schemes for RFID technology. 

PICC Frame formats:

  1. Short Frame:
  2. Standard Frames

PICC Command Set:

  1. REQA/WUPA Command: This command is send by PCD to scan the valid and IS014443 compatible PICC’s.  This command is in short frame format. Host MCU will write this command into the PCD FIFO, from where this command is transmitted and emitted wirelessly. Response to this command is with ATQA. PICC are in Idle state when listening to this command and after successfully transmitting the ATQA response they enter into Ready State. These commands consist of 7 bits, as specified below:
  2. ANTICOLLISION/SELECT Command: PICC are in ready state when listening to this command and after this command they enter into ACTIVE STATE. This Command is used to get the UID of the scanned PICC and further select the corresponding PICC for Reading and writing data from it. For the MF1S503 PICC’s UID is of 4 bytes, for that only 1 cascade level is needed.

These commands need to be configured and then these bytes are written into The PCD FIFO for transmission and emission of signal to PICC wirelessly. This Command consists of:

  • Select code SEL(1byte): Specify the cascade level. 
  • No of valid bits NVB (1 byte): specify number of bytes that would be transmitted by PCD to PICC (including SEL, NVB and below point)
  • 0 to 40 data bits of UID according to value of NVB.

ANTICOLLISION Command consist of:

  1. Select Code: Cascade level 1= 0x93
  2. No of valid bits NVB = 0x20

Response to ANTICOLLISION Command is with the UID of the Scanned PICC(0xEA, 0x24, 0x77, 0x15) and its CRC(0xAC).

  1. SELECT Command consists of:
  • Select code: Cascade level 1 = 0x93
  • No of valid bits NVB – 0x70
  • 0 to 40 data bits of UID that has been received in ANTICOLLISION Command( 0xEA, 0x24, 0x77, 0x15)
  • CRCA(1 byte) : CRC of SELECT Command would be calculated by PCD and then it would be sent to PICC. And When PICC receives the SELECT Command it will check this CRCA and then will send the ACK.(0xAC)

Response to SELECT Command is with the Select Acknowledge:

MFRC522 Hardware and Pinout

MFRC522 IC has 32 pins in total and it comes in SOT617-1 package.

MFRC522 Pinout

Pin description can be found from the datasheet of MFRC522. To use the MFRC522 IC its module is widely available and quite inexpensive. Can be brought from Robu at cost of 150 rupees. With the module an RFID tag and a key fob tag of MIFRAME Classic 1KB comes in.

MFRC522 Module

In MFRC522 module, IC has 8 pins exposed out for connection and connecting to host MCU.

  • The module has 4 pins exposed out for connecting it to host MCU using either SPI, I2C or UART. By default, reader can communicate with a microcontroller over a 4-pin SPI with a maximum data rate of 10 Mbps. It also supports I2C and UART protocols. As told in MFRC522 functional description part, MFRC522 checks the host interface type automatically depending on the signals on it’s control pins.
  • MFRC522 module has 1 interrupt pin also exposed out, which can be used to trigger interrupts to alert the microcontroller when a RFID tag is in the vicinity.
  • And remaining 3 pins are power supply pins and a reset pin. Reset pin is used for power down mode and reset signal. Module requires the power supply of 3.3 V, that is provided via VCC and GND pins.

Other vendor RFID readers

STMicroelectronics

Texas Instruments

Infenion technologies

Sensor & Modules to explore

Technologies to Explore

Other Blog to Explore

ARM processors
Kunal Gupta

Debug and Trace: ARM CORESIGHT ARCHITECTURE

Table of Contents Other Processors to know about Overview In my Last Blog We talk about Trace and Debug Features in Firmware development. What role does they play and their importance in Developing Firmware for any project and Product can be of Great Importance. Now If you are an enthusiastic engineer just like me. You might be interested in how Debug and Trace things are working and implemented in our Embedded Controllers. Like Our CPU processors are running at higher frequency of more than 10 MHz (Just to tell Some even run at more then 100-200 MHz). That is, they can perform 1000000 instructions in just a single second!!!! That is fast and insane. As I have mentioned in Previous Blog about the Debugging Features, one can execute the instructions line by line. By that I mean that one can execute 1 instruction at a time. Just imagine how fast it executes 1 instruction and one can control those executions which are happening in ns,ms,us. Doesn’t this excite you; how does that happen????????  Or if We talk about Setting Breakpoint and then halting the processor, like it means when the CPU is executing 10000000 instructions per second. One can stop Our Machine that is running at the speed of MHZ at any Particular Instruction!!!! If talking About Trace Features, it tells about our code Performance and efficiency. So, generating data like How much time does the instructions take, time for their execution, space used by them and the effect of them in our Code and Performance. Does it not excite and make you think that how actually all these things are happening inside our MCU Core Processor. And remember guys all such things are happening at a time delay of ms, ns, us. That is fast and insane. So, telling You Answer for these Questions, As I have mentioned in My previous Blog also that Trace and Debug is just like a Peripheral in our Core Processors. And they have their Own Circuitry, Components, Communication Protocol, Communication Pins, Communication Busses and Own Programmable Registers for configuring Which Debug and tracer features to use and setting them up. In the case of ARM Processors This Peripheral is designed by the name of CoreSight Architecture. Now it has a number of components like ITM, DWT, STM, DAP etc. which collectively provides features of debug, Trace, Timestamp, Prolific Counters and many more. CoreSight Debug Architecture “The ARM Cortex M/R/A processor uses the CoreSight for on-chip Debug and Trace capabilities.” CoreSight Architecture is designed in a very modular way which has Number of Components and Units providing debug and trace solutions with high bandwidth for whole systems, including trace and monitor of the system bus. These Components can be categorized in following Sections: Control and Access Components à Configure, access, and control the generation of trace/Debug. They do not generate traces, nor process the trace data.    Debug Access Port (DAP)    Embedded Cross Trigger (ECT) Trace Sources-> Components which generate trace data.    Embedded Trace Macrocell (ETM)    Instrumentation Trace Macrocell (ITM)    AHB Trace Macrocell (HTM)    Flash Patch and Breakpoint unit (FPB)    Data Watchpoint and Trace Unit (DWT)    Program Trace Macrocell (PTM)    System Trace Macrocell (STM)    Embedded Logic Analyzer (ELA)   Trace Sink -> Sinks are the endpoints for trace data on the SoC.     Trace Port Interface Unit (TPIU)     Trace Memory Controller (TMC)     Serial Wire Output (SWO)     Embedded trace Buffer (ETB) Trace Links-> provide Connection, triggering and flow of traced data between Source and Sink.     Trace Funnel     Trace Replicator     ATB Bridge Debug and Trace Buses à The CoreSight systems use the following bus protocols to connect components together, and to enable integration in a SoC.     AMBA Trace Bus (ATB).     AMBA 3 Advanced Peripheral Bus (AMBA 3 APB).     Advanced High-Performance Bus (AHB).     AMBA Advanced extensible Interface (AXI) ARM licenses the different Components of CoreSight Architecture to the SoC manufacture vendors.According to the ARM Processor these Components vary like in Cortex -A72, Trace Source components ELA and STM are there whereas in Cortex M3/M4, Trace Source Components ELA and STM are not included in its Architecture.Same way-out Trace Sink Components also vary from ARM Processor to processor.Depending on these Units and Components used by vendors for their Processor design there can be changes in features available for trace and Debug. Debug Access Port (DAP) Enables the Debug Access between SoC and Host Debugger. Debug Ports are used to access External Debugger and Access Ports are used for on chip System Resources. Debug Port (DP) JTAG and SWD (+SWO pin – for trace) are the communication Protocols which can be used for Debug/Trace. Now for Connecting and having communication with MCU core to the host debugger (Stlinkv2), we need special Port (I/O pins) on the MCU as these protocols work at very high bandwidth and are directly in play with the Processor. This port is called Debug Port. There are 3 Debug port modules which are available in all ARM cortex M processors:    SWJ-DP (Serial wire JTAG Debug Port) à Supports both Serial Wire and JTAG protocols    SW-DP (Serial wire Debug Port) à Supports only Serial Wire Protocol.    JTAG-DP (JTAG Debug Port)à Supports only the JTAG Protocol, available in older generations of ARM Processor and almost every Processor. Debug and Trace Buses & Access Port (AP) Access Port is a Port that connects the DP and the Components of the CoreSight Architecture. The CoreSight systems use the following bus protocols to connect components together, and to enable integration in a SoC. AMBA Trace Bus (ATB-AP) AMBA 3 Advanced Peripheral Bus (AMBA 3 APB) Advanced High-Performance Bus (AHB-AP) AMBA Advanced extensible Interface (AXI-AP) ARM Cortex M3/M4 Advanced High-Performance Bus (AHB-AP) is used for internal debug bus protocol to connect different Debug Components together. Embedded Cross Trigger The ECT is a modular component that supports the interaction and synchronization of multiple triggering events within a SoC. There are

Read More »

What is Autosar Technology?

All About Classic Autosar Technology at one place. From Its architecture layer to methodology to Companies and tools involved. All at one place

Read More »

Keypad Module in Embedded

Table of Contents What are Keypad Modules ? Keypads are input devices that most of us are familiar with  that help us communicate with a machine , by pressing a set of buttons or keys and giving it a set of instructions to perform tasks.We see them at ATMs, Phones,,military, even Refrigerators , Vending Machines etc constantly evolving and changing over the years such as membrane keypads,dome-switch keypads, capacitive touch keypads etc. Keypad modules are basically sets of buttons , keys or switches arranged in  rows and  columns in matrix form which establishes a connection when a button is pressed and this information is transmitted to the machine.Keypads play an important role in human machine communication be it an operator in a factory or a child buying a beverage from a vending machine . But all these variety of applications of the keypads showcases the different types of keypads and the technologies they employ. Types of Keypad Modules 1. Membrane type Membrane type keypad modules are most commonly used in commercial applications as well as household appliances such as refrigerators , coolers, calculators etc. They are  made of 3 layers : The top layer that consists of labels and printed text justifying the function of that particular key they are made up of polyester or polycarbonate materials hence the printed material lasts for a long time. This is the only layer that is visible to the user.This layer also prevents charge discharge and is water as well as heat resistant. Space layer that comprises the button which is usually made of stainless steel . They usually have a dome structure that helps them make contact with the bottom layer . Bottom layer that consists of the conductive material, usually silver or copper oxide. The parts where there is a chance of short circuit are painted with a dielectric. When the user presses a key the stainless steel button and the bottom layer comes in contact completing the circuitry which is then sent to the external ribbon as a signal . The size of these  layers are as thin as membrane hence the name membrane. Each of the layer is a half of the circuit that is connected to the external ribbon which acts as a communication path between human machine interface. PCB Type The PCB type keypad module consists of a PCB which is designed in such a manner that connections are made between each row and column on which mechanical push buttons are soldered . The connections between rows and columns are then finally ended on the 8 connector pins which are connected to the machine to identify the location of the button pressed.These can be customized as per the need. They are widely used in the phones and cheaper , easy to install and have a relatively long life. Capacitive type The capacitive touch type keypad module as the name implies uses the change in capacitance upon application of the touch as a measure to detect the human interface  . The human finger acts as a dielectric which increases the capacitance . This increased capacitance causes an increase in the charging and discharging time which is monitored and classified as touch. These are often used over their counterparts such as resistive type which are slower and less smoother.Since change in capacitance is involved these modules are also sensitive high levels of heat , light , temperature changes, liquid application  etc. To counter the behavior  of touch keypad modules under the exposure to the liquid the texas instruments keypad module uses mutual capacitance rather than self capacitance to classify a touch and distinguish false touches. Dome Switch  It’s a combination of a flat-panel membrane and mechanical-switch keypad. They feature two circuit board traces embedded under a silicone keypad with a dome-shaped switch. These domes create tactile feedback when pressed, making them particularly useful in commercial and work-related applications. Furthermore, dome-switch keypads have a high level of reliability, often lasting for as many as 5 million cycles. Scissor switch type In this keypad module the keys are designed like scissors. They also have a rubber dome key such as in dome switch but they have improved functionality  by keeping the keys connected together . They may have better functionality but they tend to be expensive and are high maintenance. They are different Scissor Switch type in the market but in general they have 3 layers. 4 x 3 The 4×3 keypad module as the name suggests consists of 4 rows and 3 columns . Even though as per the requirement the size of the matrix can vary in general the 4×3 are used in industry applications in which only numbers are required to be entered in the machine.Hence the first 3 rows consists of the numbers between 1-9 whereas the last last row consists of *,0,#. 4 x 4 Besides 4X3 the 4×4 keypad is also available in which there are 4 columns and 4 rows. In this besides the numeric values alphabets A, B , C , D are also available in the last column . This keypad module finds application in the security system , industrial control system applications, data entry systems etc. How does Keypad Modules works ? The module usually consists of graphic overlay the part of the module that is visible to the user, It is usually made of polycarbonate or polyester materials that are highly customizable depending on the requirement . The material used makes the printed character to last longer. It also consists of  an internal polymer layer which house the internal circuitry and protects from electric discharge and is also heat and water resistant  Inside the polymer layer is the button mesh layer usually made of stainless steel dome like structure and second layer of embossed circuitry usually made by printing copper or silver oxide with some dielectrics to prevent short circuit Both these layers are halves of the internal circuitry that completes the circuit when the user presses the button

Read More »
Kunal Gupta
Author: Kunal Gupta

Author

Kunal Gupta

Leave a comment

Stay Updated With Us

Error: Contact form not found.

      Blog