Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.

Gallery

Contacts

411 University St, Seattle, USA

engitech@oceanthemes.net

+1 -800-456-478-23

NFC/RFID Sensor/Module Interfacing Sensors and Modules Tech

Read and Write to a Rfid Tag

In the previous blogs we discussed how to read uid of different tags . Now as discussed in the applications of the rfid cards , the rfid tags can be used to store employee information so as to access certain restricted area. The rfid tags can also be used by retail stores to store customer information and points earned with each shopping. In this blog we’ll be learning how data reading or writing works by looking at the memory map of MIFARE 1K Tag and how to read and write the data using rc522. UNDERSTANDING THE MEMORY MAP OF MIFARE 1K TAG The memory of the MIFARE 1K Tag is divided into 15 sectors and each sector is divided into 4 blocks , within each block 16 bytes of data is stored Hence 16 Sectors * 4 Blocks * 16 Bytes=1024 Bytes = 1K The 0th Block of Sector 0 is used to store manufacturer data , this is usually 4 Byte UID(MIFARE 1K TAG, MIFARE Mini Tag) certain tags are available such as MIFARE Plus , MIFARE Desfire etc that has 7 Byte UID There are 3 data blocks presents in each sector and the last block in each sector is known as sector trailer.The 3 data blocks are used to store user data and the trailer block is used to deter mine the access conditions for all the blocks of the sector . The access conditions include Read , Write , Increment , Decrement ,Transfer and Restore. Each sector trailer consists of following information:- A mandatory 6 Byte Key A. 4 Bytes for Access Bits. Optional 6 Byte Key B (if not used, data can be stored). MEMORY ORGANIZATION MANUFACTURER BLOCK SECTOR TRAILER ACCESS CONDITIONS MEMORY ORGANIZATION MANUFACTURER BLOCK SECTOR TRAILER ACCESS CONDITIONS FUNCTIONAL DESCRIPTION uint8_t MFRC522_Write(uint8_t blockAddr, uint8_t *writeData) This function takes in 2 arguments the address to which the data has to be written and the array or buffer in which data  is stored lets say this to be writedata array. A 8 bit  array of 18 length is also intialized to store data which will be transferred to the memory block. Intially CRC is checked using CalculateCRC function using which takes in 3 arguments array in ( whose first 2 values are PICC Write and blockAddress ), len and output array that stores 2 values CRCResultRegL , CRCResultRegM . Next MFRC522_ToCard function is called which takes in 5 arguments command (in this case that will be PCD_Transceive), send data , send length , back length, back data according to various commands processing is done and according to switch cases status is sent Finally  MFRC522_ToCard in again called (with  PCD_Transceive) and the data is transferred to the FIFODataReg to return with the correct status and finally the PCD is set to idle uint8_t MFRC522_Read(uint8_t blockAddr, uint8_t *recvData) This function is used to read data from a memory block and and put it into a buffer or array hence the argument recvData Similar to uint8_t MFRC522_Write initially the CRC is calculated and MFRC522_ToCard  is called. In MFRC522_ToCard the command argument is set to PCD_TRANSCEIVE due to which the code enter the for loop in which the data that was in FIFODataReg is populated in the recvData Buffer. Finally  MFRC522_ToCard in again called (with  PCD_Transceive) and the data is transferred to the FIFODataReg to return with the correct status and finally the PCD is set to idle uint8_t MFRC522_ToCard(uint8_t command, uint8_t *sendData, uint8_t sendLen, uint8_t *backData, uint *backLen) This function is used to control the MFRC522 according to the command arguments that can be PCD_AUTHENT PCD_TRANSCEIVE Both these commands have different irqEn ,waitIRq that are written into CommIEnReg block which is then cleared using clear bit mask function After finally setting bit mask the PCD is set to idle state The function writes the data in FIFODataReg to the backData buffer and returns the status which is OK in case of no errors STM32CUBE IDE CONFIGURATION FIG 1- PINOUT CONFIGURATION FIG 2 – CONFIGURING THE SPI1 PERIPHERAL CODE #include “main.h” /* Private includes ———————————————————-*/ /* USER CODE BEGIN Includes */ #include “stdio.h” #include “stm32f1_rc522.h” #include “stdio.h” #include “string.h” #include “fonts.h” #include “ssd1306.h” /* USER CODE END Includes */ /* Private typedef ———————————————————–*/ /* USER CODE BEGIN PTD */ /* USER CODE END PTD */ /* Private define ————————————————————*/ /* USER CODE BEGIN PD */ /* USER CODE END PD */ /* Private macro ————————————————————-*/ /* USER CODE BEGIN PM */ /* USER CODE END PM */ /* Private variables ———————————————————*/ I2C_HandleTypeDef hi2c1; SPI_HandleTypeDef hspi1; UART_HandleTypeDef huart1; /* USER CODE BEGIN PV */ void uprintf(char *str) { HAL_UART_Transmit(&huart1,(uint8_t *)str,strlen(str),100); } //uint8_t i; uint8_t status; uint8_t str[5]; // Max_LEN = 16 uint8_t serNum[5]; uint8_t KEY[] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; uint8_t KEY2[]={1,2,3,4,5,6}; uint8_t W[]=”PRATYUSH”;/STEP 1/ uint8_t R[10]=””;/STEP 2/ uint8_t test; /* USER CODE END PV */ /* Private function prototypes ———————————————–*/ void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_SPI1_Init(void); static void MX_USART1_UART_Init(void); static void MX_I2C1_Init(void); /* USER CODE BEGIN PFP */ /* USER CODE END PFP */ /* Private user code ———————————————————*/ /* USER CODE BEGIN 0 */ /* USER CODE END 0 */ /** * @brief The application entry point. * @retval int */ int main(void) { /* USER CODE BEGIN 1 */ /* USER CODE END 1 */ /* MCU Configuration——————————————————–*/ /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ HAL_Init(); /* USER CODE BEGIN Init */ /* USER CODE END Init */ /* Configure the system clock */ SystemClock_Config(); /* USER CODE BEGIN SysInit */ /* USER CODE END SysInit */ /* Initialize all configured peripherals */ MX_GPIO_Init(); MX_SPI1_Init(); MX_USART1_UART_Init(); MX_I2C1_Init(); /* USER CODE BEGIN 2 */ MFRC522_Init(); /* USER CODE END 2 */ /* Infinite loop */ /* USER CODE BEGIN WHILE */ while (1) { status = MFRC522_Request(PICC_REQIDL, str); //MFRC522_Request(0x26, str) status = MFRC522_Anticoll(str); memcpy(serNum, str, 5); HAL_Delay(1000); MFRC522_SelectTag(str); test = MFRC522_Auth(PICC_AUTHENT1A,24,KEY,serNum);/STEP 3/ MFRC522_Write((uint8_t)24 , W);/STEP 4/ HAL_Delay(1000); MFRC522_Read(24, R);/STEP 5/ HAL_Delay(1000); if (status == MI_OK) { MFRC522_SelectTag(str); test = MFRC522_Auth(PICC_AUTHENT1A,2,KEY,serNum); /*if((str[0]==0) &&

BLE Embedded MCU's IoT STM32 MCU's STM32WB55 Tech

Implementation of BLE on STM32WB55

Table of Contents About GPIO Peripheral The pins which can be configured by the software at runtime to perform various functions are called GENERAL-PURPOSE INPUT/OUTPUT (GPIO) pins. With the help of software one can program the GPIO pins mainly as: Digital Output It compares the external voltage signal with a predefined threshold. Digital Input It controls the Voltage of the pin  Analog Function  It performs ADC (Analog to Digital Conversion) or DAC (Digital to Analog Conversion) Other Functions or Alternate Functions It makes the pin to perform other functions like PWM output, timer-based captures, external interrupts, and various other interfaces like SPI, I2C, UART communications. Before coming to the Schmitt Trigger Understanding, have a quick recap of Pull Up, Pull Down and Open Drain Configurations from MPU6050 Implementation blog Implementation of MPU6050 with STM32 – gettobyte GPIO Input: Schmitt Trigger GPIO Output Speed Slew Rate GPIO Input: Schmitt Trigger A SCHMITT TRIGGER is a device which uses a voltage comparator to convert a noisy or slow signal edge into a clean and desirable edge instantaneously.  For a real time system, the external signals do not change instantly, due to slower slew rate which depends on inheritance parasitic capacitance, resistance or an inductor at the  input side.  As the processor chip has a Schmitt Trigger, it increases the slew rate and increases the noise immunity for the signals which are captured. Let us understand the implementation of the Schmitt Trigger. It consists of a voltage comparator with positive feedback. The output Vout depends between two input voltage V+ and V–. If V+ > V–, Vout is quickly saturated to VSAT, otherwise Vout  = 0 For an ideal op-amp, the current flowing through resistor R3 is zero and thus we have Vref = V– The op-amp output Vout has two saturation values, as shown below Vout = VSAT if V– <V+       0 if V– < V+ However, V+ depends on Vout and Vin· Therefore, Vout depends on both the input Vin and the recent history of Vout· Such an effect is called hysteresis. Using KCL, assuming that the current flow in the non inverting input terminal of op-amp is zero, Vin – V+ /R2 = V+ – Vout / R1 On solving the above equation we will get, Vin = R2Vout + R1Vin / R1 + R2 At the time instant when Vout transits from one saturation value to the other saturation value, we have V+ = Vref Thus, Vref = R2Vout + R1Vin / R1 + R2 Solving further we get, Vin = (1 + R2/ R1)Vref – (R2/R1)Vout As discussed earlier, Vout has only two possible values. If Vout = 0 initially and Vin increases, we can obtain the trigger high threshold VTH at which Vout transits to VSAT: VTH = (1 + R2/R1) Vref – (R2/R1)*0 = (1 + R2/R1)Vref On the other hand, if Vout = VSAT initially and Vin decreases, we can obtain the trigger low threshold VTL at which Vout transits to 0: VTL = (1 + R2/R1) Vref – (R2/R1)VSAT Vout can be determined by comparing it with two thresholds VTH and VTL. When Vin climbs through VTH , Vout is rapidly switched to the upper limit VSAT· Conversely, once Vin falls below VTL, Vout makes a transition to the lower limit.  Note that VTH > VTL , i.e., the threshold for switching to high is greater than the threshold of switching to low. A Schmitt trigger when compared, Provide a better boise rejection. Larger threshold for switching high and low for switching. Immune to undesired noise. GPIO Output Speed Slew Rate The SLEW RATE of a GPIO pin is the speed of change of output voltage with respect to unit time. Slew Rate = ΔV/ Δt  In simple words, If the GPIO pin changes from LOGIC LEVEL 0 to LOGIC LEVEL 1, the voltage changes from 0V to 5V in just 5µs, then the slew rate is simply 1V/µs. The higher the slew rate, the shorter time the output voltage takes to rise or fall to desired values. Therefore, a higher slew rate allows faster speed at which the processor can toggle the logic level of a GPIO pin. A shorter rise and fall time allows a GPIO pin to change its logic value more rapidly. A high slew rate can result in significant electromagnetic interference (EMI), also known as radio frequency interference (RFI), to nearby electronic circuits. This is due to the large-amplitude and high-frequency harmonics produced by a fast-rising and falling signal, which can cause malfunctions in a victim circuit through radiation, conduction, or induction. To reduce EMI disturbance, a slower slew rate is generally preferred. GPIO IN STM32WB Each GPIO port has 4 32-bit Configuration Registers (GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR and GPIOx_PUPDR) 2 32-bit Data Register (GPIOx_IDR and GPIOx_ODR) A 32-bit Set/Reset Register (GPIOx_BSRR) A 32-bit locking Register (GPIOx_LCKR0 and 2 32-bit Alternate Function Select Register (GPIOX_AFHR and GPIOX_AFLR)   Main feature sog GPIO are Output states: push-pull or open drain + pull-up/down  Speed selection for each I/O Input states: floating, pull-up/down, analog  Fast toggle capable of changing every two clock cycles Highly flexible pin multiplexing allows the use of I/O pins as GPIOs or as one of several peripheral functions  GPIO Functional Description The port bit of GPIO can be configured by the software depending upon the hardware characteristics in various modes such as: Input floating  Input pull-up  Input-pull-down  Analog  Output open-drain with pull-up or pull-down capability  Output push-pull with pull-up or pull-down capability  Alternate function push-pull with pull-up or pull-down capability  Alternate function open-drain with pull-up or pull-down capability  Each I/O port bit is freely programmable, however the I/O port registers have to be accessed as 32-bit words, half-words or bytes. The purpose of the GPIOx_BSRR register is to allow atomic read/modify access to any of the GPIOx_ODR registers. In this way, there is no risk of an IRQ occurring between the read and the modify access. The above diagram shows the basic structure of a

BLE Embedded MCU's IoT STM32 MCU's STM32WB55 Tech

Introduction to STM32WB55

Table of Contents About STMicroelectronics STMicroelectronics is a leading provider of semiconductor solutions that are seamlessly integrated into billions of electronic devices used by people worldwide on a daily basis. The semiconductor company builds products, solutions, and ecosystems that enable smarter mobility, more efficient power and energy management, and the wide-scale deployment of the Internet of Things and connectivity technologies. To know more about STMicroelectronics refer to its website: www.st.com. Going back in history, ST was formed in 1987 by the merger of two government-owned semiconductor companies: Italian SGS Microelettronica (where SGS stands for Società Generale Semiconduttori, “Semiconductors’ General Company”), and French Thomson Semiconductors, the semiconductor arm of Thomson. In this blog, we are going to start with ST IoT-based Nucleo Board STm32WB55. What is STM32WB Series all about? The STM32WB55xx and STM32WB35xx are advanced multiprotocol wireless devices that boast ultra-low-power consumption. These devices are equipped with a powerful and efficient radio that is compliant with the Bluetooth® Low Energy SIG specification 5 and IEEE 802.15.4-2011 (Zigbee). Additionally, they feature a dedicated Arm® Cortex®-M0+ processor that handles all real-time low-layer operations. These cutting-edge devices are perfect for a wide range of applications that require reliable and efficient wireless communication. Whether you’re working on a smart home project, a wearable device, or an industrial automation system, the STM32WB55xx and STM32WB35xx are the ideal choices. With their advanced features and capabilities, these devices are sure to revolutionize the way we think about wireless communication. So why wait? Start exploring the possibilities today and discover what the STM32WB55xx and STM32WB35xx can do for you! The devices have been meticulously crafted to operate on minimal power and are built around the high-performance Arm® Cortex®-M4 32-bit RISC core, which can operate at a frequency of up to 64 MHz. This core boasts a Floating-point unit (FPU) single precision that supports all Arm® single-precision data-processing instructions and data types. Additionally, it is equipped with a full set of DSP instructions and a memory protection unit (MPU) that enhances application security. These devices have been designed with the utmost care and attention to detail, ensuring that they are not only efficient but also highly effective. The Arm® Cortex®-M4 32-bit RISC core is a powerful tool that enables these devices to perform at an exceptional level, while the FPU single precision and DSP instructions provide unparalleled accuracy and precision. Furthermore, the memory protection unit (MPU) ensures that your applications are secure and protected from any potential threats. Enhanced inter-processor communication is provided by the IPCC with six bidirectional channels. The HSEM provides hardware semaphores used to share common resources between the two processors. The devices embed high-speed memories (up to 1 Mbyte of flash memory for STM32WB55xx, up to 512 Kbytes for STM32WB35xx, up to 256 Kbytes of SRAM for STM32WB55xx, 96 Kbytes for STM32WB35xx), a Quad-SPI flash memory interface (available on all packages) and an extensive range of enhanced I/Os and peripherals.  About STM32WB55 Architecture Memories Security and Safety True random number generator (RNG) RF Subsystem Low Power Modes Clocks and Startup General Purpose Input Output(GPIOs) Direct Memory Access (DMA) Interrupts and Events Analog to Digital Convertor (ADC) Comparators (COMP) Touch Sensing Controller Liquid crystal display controller (LCD) Timers and watchdogs Real-time clock (RTC) and backup registers Inter Integrated Circuit (I2C) Universal Synchronous/Asynchronous Receiver Transmitter (USART) Serial Peripheral Interface(SPI) Serial audio interfaces (SAI) Quad-SPI memory interface (QUADSPI) Architecture Architecture STM32WB55 Architecture The host application is housed on an Arm® Cortex®-M4 CPU (named CPU1) that connects with a generic microcontroller subsystem. The RF subsystem is made up of a specialized Arm® Cortex®-M0+ microprocessor (named CPU2), Bluetooth Low Energy and 802.15.4 digital MAC blocks, an RF analog front end, and proprietary peripherals. All Bluetooth Low Energy and 802.15.4 low-layer stack functions are handled by the RF subsystem, which limits communication with the CPU1 to high-level exchanges. Some functions are shared between the RF subsystem CPU (CPU2) and the Host CPU (CPU1): Flash memories  SRAM1, SRAM2a, and SRAM2b (SRAM2a can be retained in Standby mode)  Security peripherals (RNG, AES1, PKA)  Clock RCC Power control (PWR) Memories Memories STM32WB55 Memories 2.1.  Adaptive real-time memory accelerator (ART Accelerator) The ART Accelerator is a memory accelerator optimized for STM32 industry-standard Arm® Cortex®-M4 processors. It balances the inherent performance advantage of the Arm® Cortex®-M4 over flash memory technologies. To release the processor near 80 DMIPS performance at 64 MHz, the accelerator implements an instruction prefetch queue and branch cache, which increases program execution speed from the 64-bit flash memory. Based on CoreMark benchmark, the performance achieved thanks to the ART accelerator is equivalent to 0 wait state program execution from flash memory at a CPU frequency up to 64 MHz. 2.2.  Memory protection unit In order to prevent one task from unintentionally corrupting the memory or resources used by any other active task, the memory protection unit (MPU) is used to manage the CPU1’s accesses to memory. This memory area is organized into up to eight protected areas. The MPU is especially helpful for applications where some critical or certified code must be protected against the misbehavior of other tasks. It is usually managed by an RTOS (real-time operating system). 2.3.  Embedded flash memory The STM32WB55xx and STM32WB35xx devices feature, respectively, up to 1 Mbyte and 512 Kbytes of embedded flash memory available for storing programs and data, as well as some customer keys. 2.4.  Embedded SRAM The STM32WB55xx devices feature up to 256 Kbytes of embedded SRAM, split in three blocks: SRAM1: up to 192 Kbytes mapped at address 0x2000 0000  SRAM2a: 32 Kbytes located at address 0x2003 0000 also mirrored at 0x1000 0000, with hardware parity check (this SRAM can be retained in Standby mode)  SRAM2b: 32 Kbytes located at address 0x2003 8000 (contiguous with SRAM2a) and mirrored at 0x1000 8000 with hardware parity check. Security and Safety Security and Safety The STM32WB55xx  contain many security blocks both for the Bluetooth Low Energy or IEEE 802.15.4 and the Host application. It includes:  Customer storage of the Bluetooth Low Energy and

NFC/RFID Sensor-Module Interfacing with S32K3 MCU's Sensor-Modules-interfacing Sensor/Module Interfacing Sensors and Modules SPI Modules

MFRC522 RFID module interfacing with Host MCU

Table of Contents 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. Prerequite, better to have:  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) MIFRAME RFID Tags: Overview and Datasheet Explanation About Serial Communication Protocols To know about What are Microcontrollers and introduction on them 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 Communication Pins Power Supply Pins Additional Pins Logic Analyzer Communication Pins 4 pins are communication pins, that would be connected to Host MCU either using SPI, I2C, or UART. MFRC522 Communication Pins We would be making the connection using the SPI peripheral. Here I am referencing out hardware connection with 2 microcontrollers: NXP Semiconductors S32K144 MCU and STMicroelectronics STM32F103 MCU. STMicroelectronics STM32F103 would be using SPI-1 Instance and S32K144 would be using LPSPI-0 Instance.  Power Supply Pins 2 pins are for Power Supply Connection, which would be used for powering the RFID reader. One can power the MFRC522 Reader via Host MCU. Connect the VCC and GND pins with the Host MCU Power pins. Make sure, you supply MFRC522 with 3.3 V, don’t power it with 5V. MFRC522 Power supply connections Additional Pins There are 2 additional pins on MFRC522: IRQ and RST pins. IRQ pin is an interrupt pin, that is used for alerting the HOST MCU  when an RFID tag is in the vicinity. Read about the IRQ pin and interrupts in MFRC522 from here. RST pin would be not used for this project. Logic Analyzer These connections are for debugging and understanding purposes. By connecting the logic analyzers, we would be able to see how literally SPI communication and what commands we are sending, and what responses we are getting in bit and byte levels. Would recommend doing this step, as it makes the understanding clear at the root level. It would hardly take a couple of minutes to setup this. For connecting the logic analyzer, connect the Channel1,3,5,7 of the logic analyzer with communication pins. I am using the Salae logic analyzer, which is readily available. viewers can refer to this video on Gettobyte Youtube channel on how to set up logic analyzer connections, hardware, and software. Logic Analyzer 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 Host Interfaces MFRC522 FIFO MFRC522 CRC MFRC522 Interrupts MFRC522 Time Unit MFRC522 Command Set MFRC522 Host Interfaces MFRC522 Host Interface API’s We are going to connect MFRC522 via the SPI interface to the host MCU. SPI configurations: MSB is sent first 8 Bits per transfer The clock is Low when inactive(CPOL=0) Data is valid on Clock Leading Edge(CPHA=0) Enable line is Active LOW SPI Address Byte These address bytes are of 6 bits. When sending the address byte, MSB should tell whether we have to perform a read/write operation on that address. LSB is always set to logic 0 when sending the address byte. Thus you would find in the below driver that MFRC522 registers which are defined in GB_MFRC522.h have been left shifted 1 bit so that the MSB bit can be configured whether to perform a Read or write operation on that register address. SPI Read Data To read the data, Host MCU will send the register address at the MOSI line with LSB as 1 and then in MISO, it would get the data. This would be performed via a low-level function, that is reading one single byte from the address GB_reg which is sent in its argument. uint8_t GB_MFRC522_ReadRegister(PCD_Register GB_reg); For e,g we have to read the version of the MFRC522, which can be done via VersionReg(ox37): uint8_t v = GB_MFRC522_ReadRegister(VersionReg); So it would be left shifted first: 0x37<<1 = 0x6E(So that can configure MSB for read and Write operation). And then as we want to perform a read operation at this register, so need to write MSB with 1. We will Or above value with 0x80( See definition of uint8_t GB_MFRC522_ReadRegister(PCD_Register GB_reg): 0x6E | 0x80 = 0xEE. As per the datasheet, reading this register would give either 0x92 or 0x91.(Refer the datasheet for in-depth-description of this register). In logic analyzer reading from the  MFRC522 would look like this: MFRC522 version

NFC/RFID Sensors and Modules

RFID reader module: MFRC522

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. Table of Contents Next & Previous Blog Previous Blog: What Is RFID TEchnology RFID Reader MFRC522 Interfacing with Host MCU 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 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 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 Host Interfaces MFRC522 Interrupts MFRC522 Time Unit MFRC522 FIFO MFRC522 CRC Host MCU to MFRC522 Command Set MFRC522 to PICC command set MFRC522 Host Interfaces MFRC522 Host Interfaces MFRC522 can be connected to Host MCU using 3 serial protocols: UART, I2C or SPI. MFRC522 checks the current host interface type. automatically after performing a power-on or hard reset. The MFRC522 IC identifies the hostinterface by sensing the logic levels on the below pins after the reset phase.  The MFRC522 is equipped with a series of registers that allow the Host MCU to access its functional description blocks. To ensure the proper functioning of the MFRC522, the Host MCU must initialize and configure these functional blocks by sending the corresponding register addresses. Each register is essentially an address byte that is transmitted from the Host MCU. Depending on the function described in the register section, read/write operations are performed on the corresponding address byte. It is crucial to properly initialize and configure these functional blocks to ensure the optimal performance of the MFRC522. By understanding the purpose of each register and its corresponding function, the Host MCU can effectively communicate with the MFRC522 and achieve the desired results. –> MFRC522_write_register() –> MFRC522_Read_register() MFRC522 Interrupts MFRC522 Interrupts MFRC522 can trigger the interrupts, when certain events occur. There are 8 events as shown in below table when interrupt can be triggered. When above event occurs, IRQ pin is used to interrupt the host. IRQ pin signal is asserted and host MCU can use its interrupt handling capabilities (basically NVIC if we are talking about ARM based MCU) on what to do when corresponding interrupt has occurred. Status1Reg Register IRq bit is used to indicate if any interrupt source has been triggerered. Status1Reg register IRq bit Which interrupt has been triggered is indicated by ComIrqReg and DivIrqReg Register.  ComIrqReg Register DivIrqReg Which interrupts to be configured and behavior of IRQ pin is configured by ComIEReg and DivIEReg Register. ComIEnReg DivIEnReg MFRC522 Time Unit MFRC522 Time Unit There is a Timer unit in MFRC522, that is used for multiple purposes. Timer unit is essential for maintaing the configuring the clock and analog interfaces. Also timer unit can be used for following features: Timeout counter Watchdog counter Stopwatch Programmable one shot Periodical trigger Timer has an input clock of 13.56 MHz derived from the 27.12 MHz quartz crystal oscillator. The timer consists of 2 stages: prescaler and counter. The prescaler(TPrescaler) is a 12-bit counter. That can be configured using TModeReg register’s TPrescaler_Hi[3:0] and TPrescalerReg register’s TPrescaler[7:0] bits. The Reload value for the counter is defined by 16 bits between 0 & 65535 in the TReloadReg register. The current value of the timer is indicated in the TCounterVAlReg Register.  MFRC522 FIFO MFRC522 FIFO FIFO overview The MFRC522 contains an internal FIFO buffer of 64 bytes, which is equivalent to 8 x 64 bits. This buffer is utilized for both input and output data streams. The host MCU has the capability to perform both Read and Write operations on this FIFO. The host MCU

NFC/RFID Sensors and Modules

What is RFID technology? Applications, Working Principal, Types, Projects

Table of Contents What is RFID technology? RFID is a technology by which objects can be tracked and identified using electromagnetic fields. RFID stands for Radio Frequency Identification. An RFID system consists of an RFID reader known as a Proximity Coupling device (PCD) and RFID tags known as Proximity Integrated Circuit Cards (PICC). RFID Tags are attached to the objects which need to be tracked/identified and each tag has a unique value hard coded. RFID readers are attached to the main system/computer where all the processing takes place. Now, these tags are brought in close proximity to the RFID readers, RFID readers decode the value and send the information to the main system for tracking/identifying/monitoring purposes depending on the application. RFID technology is similar to a barcode or the magnetic stripe of a credit card, as the data encoded in the label or magnetic strip can be captured by a device and stored in a database. RFID belongs to a group of technologies referred to as automatic identification and data capture (AIDC). AIDC methods automatically identify objects, collect data about them and enter the data directly into systems with little or no human intervention. RFID methods use radio waves and automation technologies to accomplish all of this. This technology has grown a lot since its first application. It has not only been improved over the years but also the cost of implementing and utilizing it continues to minimize, making this technology more efficient and affordable. In its simplest form, an RFID system consists of 2 components: an RFID tag and an RFID reader. Refer to the section below to know more in-depth about RFID tags and Readers. RFID tags are used to track objects, by reading/writing information on them and are usually composed of an integrated circuit, antenna, and battery. The integrated circuit stores the data and powers the antenna, allowing it to be read by a reader. Tags contain digitally encoded information that is stored in the integrated circuit and is transmitted to the reader. Readers are devices that intercept, decode, and interpret the information stored in the tag. Typically, readers consist of RFID antennas, multiple operating modes (active and passive), frequency capabilities, and signal processing. The readers, antennas, and tags work together to collect data from RFID tags and transmit it to computer systems. RFID Reader (PCD) PCD(Proximity Coupling device): Also known as RFID readers. They decode the RFID Tags and communicate with them based on ISO14443 standard. PCD can perform read and write operation of data i.e bidirectional communication once PCD and PICC are coupled together. The coupling between PCD and PICC is based on inductive coupling (Refer to Working principle of RFID technology to know physics behind it).PCD energizes the PICC by coupling with them when PICC comes in close vicinity of PCD.And PICC gets energized, it starts transmitting its radio signals with UID of it. For energizing the PICC, they need to be brought in close proximity so that PCD magnetic fields get properly coupled with PICC. PCD’s have the memory(FIFO buffers, EEPROM), communication pins for Host Interface(I2C,SPI,UART), antenna for generating of radio signals, power supply, I/O pins(Interrupt and Timer pins), small CPU for processing of data(CRC,Interrupt controller, Timer unit), Analog interface for RF front head(oscillators, PLL, PGA and etc), Low power modes and support of multi protocols for decoding tags. PCD has the crypto features also implemented inside them, so that only authenticated RFID readers can communicate with PICC. And this also becomes the distinguishing feature in different PCD’s. Like NXP semiconductors, RFID readers follow the crypto-1 cipher for authenticating. Also some PCD’s have secure models and key handling capabilities for secure communication between PCD and PICC for banking and transaction related applications. There are many semiconductor companies who provide the RFID reader chips, with many enhanced features.NXP semiconductors and STMicroelectronics are world leaders in providing RFID reader chips. NXP semiconductors has a family of RFID/NFC chips with many enhanced features. For more indepth knowledge on PCD, viewers can refer to:Radio-frequency identification – Wikipedia. In the upcoming blog, we are going to interface NXP semiconductors MFRC522 and PN512 with host MCU. By making its device driver and to showcase the working of PCD’s RFID Tag(PICC) PICC (Proximity Integrated Circuit Card): These are the RFID Tags, which are known as Proximity Integrated Circuit cards, in technical terms. PICC are attached to the objects which need to be tracked. PICC consists of an antenna for generation of radio waves and memory for storing the UID and other information of PICC. Each PICC has a Unique value hardcoded inside them. This unique value is referred to as UID. The UID value is 7 bytes. PICC have memory divided in terms of blocks and sectors for storing the important information. There are mainly 2 types of PICC/RFID tags. Active tags and Passive tags. Active tags: They have on chip batteries; thus, they can operate at bigger distances and can operate at higher frequencies. Passive tags: They don’t have an on-chip battery, instead they get energized and get the power from the PCD’s.magnetic fields. Thus, Passive tags need to be brought in very close proximity to PCD of about 1-2 cm, for decoding its value. Also, tags are available in many different shapes, depending on the application. They come in credit card-based shapes, to small key ring-based shapes. Also, some tags have crypto features inside them for authentication purposes when PCD’s communicate with them. NXP semiconductor is a world leader in providing RFID Tag chips. Their MIFRAME family of RFID tags has been implemented in 1000’s of devices and use cases. PCD and PICC communicate with each other according to ISO14443 spec. There are certain commands specified in that protocol, which are at first transmitted by PCD’s and then corresponding PICC responds, and the communication session is initialized. For more in-depth knowledge on PICC, viewers can refer to:Radio-frequency identification – Wikipedia. NXP semiconductor is a world leader in providing RFID Tag chips. Their MIFRAME family of RFID tags

BLE IoT

Bluetooth Low Energy (BLE)

Motivation is necessary to reach to our goals but discipline is needed to make them achievable. What is Bluetooth Low Energy? This series of blogs on BLE, is for anyone who is going to start with Bluetooth Low Energy. Bluetooth energy comes under the short range wireless communication protocols of IoT. So lets start by understanding what is BLE. Bluetooth is a wireless communication protocol that is started as a cable replacement technology to replace wires in devices like mouse, keyboards and etc. It operates at 2.4Ghz in unlicensed ISM frequency brand. Their are two types of Bluetooth devices: one is Bluetooth Classic(BR/EDR) and Bluetooth Low Energy. Bluetooth versions from Version 1.0 to 3.0 are referred as Bluetooth Classic and from 4.0 to latest version 5.2 are referred as Bluetooth Low Energy(BLE). Bluetooth protocol is backwards compatible. Bluetooth Classic technology is developed as a wireless standard allowing cables to be replaced connecting portable and fixed electronic devices, but it cannot achieve extreme level of battery life because of its fast hopping, connection oriented behaviours and relatively complex connection. Bluetooth Classic further has Basic Rate mode(V1), Enhanced Data Rate mode(V2) and High Speed mode(v3). In this article we will not dwell much into the Bluetooth Classic, our discussion area will be confined to Bluetooth low Energy. BLE stands for Bluetooth Low Energy, which has been created for the purpose of transmitting very small packets of data at a time, while consuming significantly less power then Bluetooth Classic. Now for working with any wireless communication protocol, their are 2 important concepts that have to be understood for it. Its Communication Protocol Architecture and Communication protocol Stack( it is the firmware implementation of the Architecture). So for proceeding with BLE, we will first understand Its architecture, about the terms like GATT,GAP, HCI and how does Bluetooth low energy works and then further will understand its stack on Nordiac devices. Click here Read more such articles:

Stay Updated With Us

Error: Contact form not found.