background image

 EHUOYAN 

                                                                           

             

YHY522R   

         

RFID module 

Page 10 of 36 

 

1. Header: 

This header has 2 bytes that indicates the beginning of a frame. These 2 

bytes should be always 0xAA 0xBB. 

2. Length: 

This byte is used to indicate the length of the payload data. This includes 

the Length, Command and the Data bytes 

3. Status: 

This is the status for which the response is being sent back. If ok then the 

module return the command which host has sent, if failure it return the 
ones-complement  code.  For example,  the command is 0x19, then the 
ones-complement code is 0xe6.       

 

4. Data

: This contains the result data if an operation was successful. It may be empty. 

5. CSUM: 

This is the checksum byte. This byte is used on the host as well as the 

module to check the validity of the packet and to trap any data 
corruption. This is calculated by 

XOR

 all the bytes in the packet except 

the Header and CSUM byte. 

CSUM=Length

Command

Response[0]

Response[1]

Response[n-1]

   

 

AA BB 06 20 

3D 98 62 01

 E0 

0x20: Auto scan UID. 

3D 98 62 01: UID

 

 

12

. Power Reduction mode   

___  _____________________

 

 

 

12.1  Hard Power-down 

A Hard Power-down is enabled with sending command 

0x03

 to the 

YHY522R . This turns off all internal current sinks as well as the oscillator. All 
digital input buffers are separated from the input pads and clamped internally. 
The output pins are frozen at a certain value. 

 

 

12.2  Transmitter Soft Power-down 

The Transmitter Soft Power-down mode is entered immediately after send 
command 

0x11

 to the YHY522R . The module will switch off the antenna 

power, but the mcu is still working. 

 

13

. Reset   

___  ___________________                 _

 

The YHY522R    is reset when a low level is present on the RST pin for 
longer than the minimum pulse length. During Reset, all I/O pins are set to 
their initial states, and the program starts execution from the Reset Vector. 

Table 7: Reset Characteristics 

Summary of Contents for YHY522R

Page 1: ...YHY522R RFID module RFID NFC Reader Writer Module User manual Version 1 0 Dec 2018 RFID SMART RFID MODULE ...

Page 2: ...ower reduction mode 10 12 1 Hard power down 11 12 2 Transmitter soft power down 11 13 Reset 11 14 YHY522R Command set 12 14 1 Commands overview 12 14 2 Commands and response 12 14 2 1 Detect_Clone 13 14 2 2 MSleep 13 14 2 3 MConfigure 14 14 2 4 Download_Keys 17 14 2 7 Antenna_Control 17 14 2 8 Sense_mode 18 14 2 13 Change_Card_Keys 19 14 2 15 Card_Sleep 20 14 2 16 Card_Type 21 14 2 17 Card_ID 21 1...

Page 3: ...EHUOYAN YHY522R RFID module Page 3 of 36 16 Package outline 35 17 Contact information 36 ...

Page 4: ...o host automatically In the slave mode the module just needs only one command to finish one action such as read or write data from card s block The user does not need input three steps request anticollision and selection The module will do this function for you automatically What you need is just sending one command to the module Then it will send back what you want Anything is just so simple and ...

Page 5: ...st data collection systems Figure 1 YHY522R Applications 5 Quick reference data _____________________________ Table 1 Quick reference data Symbol Parameter Conditions Min Typ Max Unit VCC Supply voltage GND 0V 2 7 5 0 7 0 V IHPD Hard Power down Current 100 uA IASD Antenna Soft down VCC 5 0V 15 20 mA IVCC Supply Current VCC 5 0V 53 75 mA DRW Read Write card Distance VCC 5 0V 0 60 mm Tamb Operating ...

Page 6: ..._ Figure 2 Simplified YHY522R Block diagram The Analog circuitry and MFRC522 handle the modulation and demodulation RFID signal The MCU handles the protocol requirements for the communication schemes including the RF base protocols as well as the protocols for host communication 8 Pinning information _____________________________ 8 1 Pining ...

Page 7: ...escription J1 1 J1 2 J1 3 J1 4 J1 5 RST I Reset active low floating for power on reset by default J1 6 TXD O RS232 Transmitter J1 7 RXD I RS232 Receiver J1 8 VCC PWR Power supply J1 9 GND PWR Power supply Ground 9 Functional description _____________________________ YHY522R supports the Reader Writer mode for ISO IEC 14443A MIFARE card ...

Page 8: ...transfer speeds The default transfer speed is 19 2 kbit s To change the transfer speed the host controller has to write a value for the new transfer speed by the CONFIG command after reset the module the new speed will active Table 5 Selectable transfer speeds Transfer Speed kbit s Configure Code 2 4 1 4 8 2 9 6 3 14 4 4 19 2 5 38 4 6 57 6 7 115 2 8 230 4 9 10 4 Transfer Protocol YHY522 J1 RXD TXD...

Page 9: ...s for the module to execute the command For example for a Read command the data will be the block number to be read and the authenticated key For a Write command this will be the block number and the authenticated key and 16 bytes data to write into the block For other command it maybe empty 5 CSUM This is the checksum byte This byte is used on the host as well as the module to check the validity ...

Page 10: ... bytes in the packet except the Header and CSUM byte CSUM Length Command Response 0 Response 1 Response n 1 AA BB 06 20 3D 98 62 01 E0 0x20 Auto scan UID 3D 98 62 01 UID 12 Power Reduction mode ___ _____________________ 12 1 Hard Power down A Hard Power down is enabled with sending command 0x03 to the YHY522R This turns off all internal current sinks as well as the oscillator All digital input buf...

Page 11: ...timing 14 YHY522R Command Set ___ ____________________ 14 1 Commands overview The commands for the YHY522R include system commands and RFID commands The system commands are use for controling the module settings and save parameters to the EEPROM The RFID commands are use to operating the RFID card such as read or write block data Table 8 Command list ...

Page 12: ...on or off 0x13 Sense_Mode Set Auto Sense Mode RFID COMMANDS 0x06 Change_Card_Keys Change the Card s Key 0x12 Card_Sleep Card Sleep Halt 0x19 Card_Type Read Card Type 0x20 Card_ID Read Card UID S50 commands 0x0c Detect_Clone Detect a clone card 0x21 Block_Read Read Data From Card Block 16 bytes 0x22 Block_Write Write Data Into Card Block 16 bytes 0x23 Value_Init Initialize block data to Value forma...

Page 13: ...0C 0E Description AA BB 02 0C 0E Head Length Status BCC Receive Failure AA BB 02 F3 FE Description AA BB 02 F3 F1 Head Length Error BCC 14 2 2 MSleep After executing this Command the YHY522R will power down waking up the module it needs to give the RST pin a low level pulse or Re power on the module Table 12 Command Host ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB 0x02 0x03 0x0...

Page 14: ...ring Block R RFU RFU Start Sector End Sector Auth Mode RFU Baud Code D 0 Auto code 0 Auto function off the YHY522R will not auto seek card and the IRQ pin is not active 1 Auto seek card if there are cards in the RF field the RED led will light and IRQ pin will output low level 2 Same 1 and it will read the card id and upload to host and then halt the card 3 Same 1 and it will read the selected blo...

Page 15: ...BB 0x02 0xFB 0xF9 Table 18 Example 1 Auto read card id Auto code 0x02 Send AA BB 12 04 02 00 FF FF FF FF FF FF 00 00 00 00 00 00 00 08 1C Description AA BB 12 04 02 00 00 08 1C Head Length COMMAND Auto code auto read id Any data Baud code 115200bps BCC Receive Success AA BB 02 04 06 Description AA BB 02 04 06 Head Length Status BCC Receive Failure AA BB 02 FB F9 Description AA BB 02 FC FE Head Len...

Page 16: ... 61 10 28 08 Data in the block 0 Example 3 Auto Read NTAG213 NFC NDEF text dada Auto code 0x08 Configure command Host ÆYHY522R AA BB 12 04 08 00 FF FF FF FF FF FF 00 00 00 00 00 00 00 05 1B Description 08 Auto code 05 Baud code 19200bps If success then reset the YHY522R to active this function The reader will read the NFC tag when there is a tag into the RF field and then output the status to host...

Page 17: ... Header Length Command Data XOR Checksum 0xAA 0xBB 0x09 0x05 7 bytes Sector 1 byte Keys 6 bytes BCC Sector 0 0x27 mifare 4 k card has 40 sectors Keys KeyA or KeyB default FF FF FF FF FF FF Table 20 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x02 0x05 0x07 Failure 0xAA 0xBB 0x02 0xFA 0xF8 Table 21 Example Send AA BB 09 05 01 FF FF FF FF FF FF 0D Descriptio...

Page 18: ...or BCC 14 2 8 Sense_Mode This command can change the auto sense mode any time during the YHY522R working it needs no reset operation Table 31 Command Host ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB 0x03 0x13 Auto code 1Byte BCC Auto code 0 Auto function off the YHY522R will not auto seek card and the IRQ pin is not active 1 Auto seek card if there are cards the RED led will li...

Page 19: ...sum 0xAA 0xBB 0x1A 0x06 Key Info 24 bytes BCC Key Info Key type Sector number Old Key New Key Key A Access bits Key B Key type 1 byte 0x00 Key A 0x01 Key B Sector number 1 byte 0x00 0x27 0 39 Old Key 6 bytes default FFFFFFFFFFFF Key A 6 bytes new key Access bits 4 bytes FF 07 80 69 Key B 6 bytes default FF FF FF FF FF FF Note If auth mode is 1 then this key is not active it can be any 6 data bytes...

Page 20: ...vate the card need to remove the card from antenna area and put the card into antenna area again Or reset the YHY522R to repower the card Table 51 Command Host ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB 0x02 0x12 0x10 Table 52 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x02 0x12 0x10 Failure 0xAA 0xBB 0x02 0x ED 0xEF Table 53 Example ...

Page 21: ... NTAG2XX Table 56 Example Send AA BB 02 19 1B Description AA BB 02 19 1B Head Length COMMAND BCC Receive Success AA BB 04 19 04 00 19 Description AA BB 04 19 04 00 19 Head Length Status Card TYPE 04 00 S50 Card 02 00 S70 Card BCC Receive Failure AA BB 02 E6 E4 Description AA BB 02 E6 E4 Head Length Error BCC 14 2 17 Card_ID This command read the mifare card UID Table 57 Command Host ÆYHY522R Send ...

Page 22: ...Length Command Data XOR Checksum 0xAA 0xBB 0x0A 0x21 Block Info 8 bytes BCC Block Info Key type Block number Key Key type 1 byte 0x00 Key A 0x01 Key B Block number 1 byte 0x00 0xff 0 255 Key 6 bytes default FFFFFFFFFFFF Note If auth mode is 1 then this key is not active it can be any 6 data bytes Table 61 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x12 0x...

Page 23: ...BB 0x1A 0x22 Block Info 24 bytes BCC Block Info Key type Block number Key BData Key type 1 byte 0x00 Key A 0x01 Key B Block number 1 byte 0x01 0xff 1 255 Key 6 bytes default FFFFFFFFFFFF BData 16 bytes data to be write into card Note If auth mode is 1 then this key is not active it can be any 6 data bytes Table 64 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xB...

Page 24: ...t the length does not add 1 14 2 20 Value_Init This command initializes block as value format It needs to perform this command before any block to be use as value format Below is the description of value block Table 66 Command Host ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB 0x0E 0x23 Value Info 12 bytes BCC Value Info Key type Block number Key Value Key type 1 byte 0x00 Key A ...

Page 25: ... 2nd block Authenticate with Key A 4 bytes value BCC Receive Success AA BB 02 23 21 Description AA BB 02 23 21 Head Length Status BCC Receive Failure AA BB 02 DC DE Description AA BB 02 DC DE Head Length Error BCC 14 2 21 Value_Read This command reads value from the appointed block Table 69 Command Host ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB 0x0A 0x21 Value Info 8 bytes BC...

Page 26: ... This command perform value increment Table 71 Command Host ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB 0x0E 0x25 Value Info 12 bytes BCC Value Info Key type Block number Key Value Key type 1 byte 0x00 Key A 0x01 Key B Block number 1 byte 0x01 0xfe 1 254 Key 6 bytes default FFFFFFFFFFFF Value 4 bytes value to increment low byte first Note If auth mode is 1 then this key is not ...

Page 27: ...es BCC Value Info Key type Block number Key Value Key type 1 byte 0x00 Key A 0x01 Key B Block number 1 byte 0x01 0xfe 1 254 Key 6 bytes default FFFFFFFFFFFF Value 4 bytes value to decrement low byte first Note If auth mode is 1 then this key is not active it can be any 6 data bytes Table 75 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x02 0x26 0x24 Failure...

Page 28: ...6 bytes default FFFFFFFFFFFF Source block 1 byte Target block 1 byte Note If auth mode is 1 then this key is not active it can be any 6 data bytes Table 78 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x02 0x27 0x25 Failure 0xAA 0xBB 0x02 0xD8 0xDA Table 79 Example Send AA BB 0B 27 00 FF FF FF FF FF FF 09 0A 2F Description AA BB 0B 27 00 FF FF FF FF FF FF 0...

Page 29: ...le 81 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB Len 0x2A Sector data 49 Bytes BCC Failure 0xAA 0xBB 0x02 0xD5 0xD7 Len 0x33 51 if sector is 0 31 Sector data Sector number 1 byte Blocks data 48 Bytes Table 82 Example Send AA BB 0A 2A 00 01 FF FF FF FF FF FF 21 Description AA BB 0A 2A 00 01 FF FF FF FF FF FF 21 Head Length COMMAND Authenticate with Key A R...

Page 30: ...FFFFFFFFFFFF SData 48 Bytes data to be write into card Note If auth mode is 1 then this key is not active it can be any 6 data bytes Table 84 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x02 0x2B 0x29 Failure 0xAA 0xBB 0x02 0xD4 0xD6 Table 85 Example Send AA BB 3A 2B 00 01 FF FF FF FF FF FF 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 22 22 22 22 11 22 ...

Page 31: ... 0xAA 0xBB 0x02 0xD7 0xD5 Table 88 Example Send AA BB 03 28 03 28 Description AA BB 03 28 03 28 Head Length COMMAND Start page BCC Receive Success AA BB 12 28 00 11 22 33 44 55 66 77 88 99 AA 00 BB CC DD EE FF 3A Description AA BB 12 28 00 FF 3A Head Length Status 16 Bytes Data BCC Receive Failure AA BB 02 D7 D5 Description AA BB 02 D7 D5 Head Length Error BCC If receive one block data include AA ...

Page 32: ... 02 29 2B Head Length Status BCC Receive Failure AA BB 02 D6 D4 Description AA BB 02 D6 D4 Head Length Error BCC 14 2 29 Ntag_Read_Text This command will read the NTAG213 NDEF text data Send command aabb03130010 to switch off the auto scan then send AA BB 02 20 22 to get the UID of the tag at last you can send this command to read the NDEF data Table 92 Command Host ÆYHY522R Send Header Length Com...

Page 33: ...ost ÆYHY522R Send Header Length Command Data XOR Checksum 0xAA 0xBB Len1 0x41 Data BCC Data Lock Len2 Text Lock 00 rewrite 01 Lock read only Len2 length of the text up to 58 bytes Text NFC NDEF ascii code Table 96 Response YHY522R ÆHost Receive Head Length Status Data XOR Checksum Success 0xAA 0xBB 0x02 0x41 BCC Failure 0xAA 0xBB 0x02 0xBE 0xBC Table 97 Example Send AA BB 0E 41 00 0a 30 31 32 33 3...

Page 34: ...TIONS MIN TYP MAX UNIT Tamb Ambient Temperature 25 25 85 C VCC DC Supply Voltages GND 0V 2 7 5 0 7 0 V RD Reading Distance VCC 5 0V 0 50 60 mm WD Writing Distance VCC 5 0V 0 40 50 mm 15 2 Current Consumption Table 87 Current Consumption SYMBOL PARAMETER CONDITIONS MIN TYP MAX UNIT IVCC Supply Current VCC 2 7V 3 6V Continuous read or write 43 65 mA Antenna Soft Power Down 25 30 mA Module Hard Power...

Page 35: ...EHUOYAN YHY522R RFID module Page 35 of 36 Figure 8 YHY522R Top view ...

Page 36: ...ck side View 17 Contact information ___ _____________________ To obtain information about EHUOYAN sales and technical information please reference the following information Contact Information Ehuoyan Technology Co Ltd Tel 86 010 80128328 email info ehuoyan com Web Site http www ehuoyan com ...

Reviews: