MiFare is a contactess smart cards system and is being trademark by NXP Semiconductors. Currently, Cytron Technologies is carrying the MiFare ISO14443A Classic 1K or 4K card reader/writer – CR038A. In conjunction with that, this tutorial will demonstrate interfacing MiFare reader/writer CR38 through GUI software in computer to perform some basic actions like writing/reading data or values to/from data blocks and executing increment or decrement on the values stored in data blocks of a MiFare card.
- MiFare Reader/Writer CR038 (RFID-ICRW-CR038) – 1
- MiFare Card (RFID-TAG-MYF-CA) – 1
MiFare ISO14443A 1K Classic card used in this tutorial for demonstration
- USB to UART Converter (UC00A) or USB to UART converter V2011(UC00B)
*UC00A is used in this tutorial for demonstration
- USB MiniB Cable (2.0) (WR-USB-M) – 1
- Female to Female Jumper Wire (WR-JW-FF10) – 1 pack
Tools and Equipment:
- Soldering Iron
- Solder Lead
- Solder Paste (optional)
- MiFare reader/writer GUI software can be downloaded from Cytron Technologies,RFID-ICRW-CR038
- USB drivers and installation guides of UC00A can be downloaded from Cytron Technologies, UC00A.
- User manual and other related materials of RFID-ICRW-CR038 can be downloaded from Cytron Technologies,RFID-ICRW-CR038
- User manual and other related materials of UC00A can be downloaded from Cytron Technologies, UC00A.
*Users are encouraged to go through the user manual of RFID-ICRW-CR038 for better understanding on how a MiFare reader/writer works.
*Users are encouraged to go through the user manual of UC00A for better understanding on connections between MiFare reader/writer and UC00A.
- Download the driver of UART to USB Converter (UC00A) and install it according to the installation guides.
- After the USB driver is successfully installed, with the UC00A still connected to the computer through USB miniB cable, the COM port assigned to UC00A can be checked through the Device Manager under the Ports (COM & LPT) category. In this case, the COM port is COM 6.
Figure 1: COM port assigned for UC00A
3.Next, solder the 1×7 header pin (male) to the flex cable breakout board of the MiFare reader/writer CR38 (RFID-ICRW-CR038) as shown in Figure 2 below.
Figure 2: Solder header pins to flex cable breakout board of MiFare reader/writer
4. Establish the connections between the UC00A and the MiFare reader/writer using female to female jumpers according to picture shown in Figure 3 below.
Connections at MiFare reader/writer
Overall connections between the MiFare reader/writer and UC00A
Figure 3: Connections between UC00A and MiFare reader/write
- Connect the UC00A to computer (if it is no connected yet) so as to power MiFare reader/writer and establish communication connection between it and computer.
- Download the MiFare reader/writer GUI software (which is a zip file called RFREADER-en.zip) and unzip it into a folder.
- In the resulted folder, double clicks the ICTransfer.exe to launch the MiFare reader/writer GUI.
Figure 4: Launch the MiFare GUI software
Figure 5: Starting page of the software
5. Firstly, the port for communication with MiFare reader/writer need to be configured. Go to Set(P) tab at the top of the window and choose the “Port Set” option. The port configuration panel will appear as shown in Figure 6 below.
Figure 6: Port configuration panel
6.Under the Port Setting group box, select COM6 (in this case) as the communication port with baudrate, 19200bps (default communication baudrate of MiFare reader/writer). Press the Connect button afterwards.
Figure 7: Port Setting group box
7. If the connection is successfully established, the success notification message will show at the top (in the Memo textbox) and the bottom (notification area) of the MiFare reader/writer GUI.
Figure 8: Notification message
*The locations highlighted in Figure 8 will show related notification message when a particular operation is executed in the MiFare reader/writer GUI.
8. Next, under the Information group box, press the Get button. The information regarding the model and version of the MiFare reader/writer, also with the types of card supported will be shown.
Model and version of the MiFare reader/writer
Types of card supported
Figure 9: Information regarding the MiFare reader/writer
9.There are other operations which can be done in the port configuration panel like:
- Under the Light group box – turn on or off the LED on the MiFare reader/writer
- Under the Icdeve group box – obtain the device number of the MiFare reader/writer
- Under the Beep group box – adjust the time length for beep of the MiFare reader/writer
- Under the Antenna group box – turn on or off the antenna of the MiFare reader/writer
10.After the communication port is configured accordingly, go to Choose Card (I) at the top of the window, choose the ISO1443A > MiFare_Std S50 option. This will open the communication panel for MiFare reader/writer with card type of MiFare_Std S50.
Figure 10: Communication panel for MiFare reader/write with card type of MiFare_Std S50
11. Now, it is now ready to perform reading and writing operation to a MiFare Card. Firstly, please put the MiFare card close to or simply at the top of the MiFare reader/writer.
*The MiFare is need to be keep placing on the top of MiFare reader/writer throughout the operations introduced in the following sections.
Figure 11: MiFare card at the top of the MiFare reader/writer
12. Next, make the MiFare card request by pressing the Request button above the Purse Function group box. As the result, the serial number or NUID (BA96B21F in this case) of the MiFare will be shown in the text box besides the Request button.
Figure 12: MiFare card request
13. As the card request is successful, the MiFare is ready to be read or written. Direct read from or direct write to the data blocks in memory of the MiFare can be executed under the Operation Window group box.
14. For the read operation, it is implemented in term of sector where the info or data for all 4 blocks in sector selected will be shown in the Operation Window as the read operation is executed.
Figure 13: Direct read operation of MiFare card
*The Block 0, 1 and 2 of a sector are data blocks where they are blank and zero in default except for the Sector 0 where its Block 0 (which is the manufacturer block – reserved and read-only) filled with manufacture information about the MiFare card.
*Block 3 of each sector is known as Sector trailer of that sector and contains information like Key B, Access bits, and Key A.
16. Now, let’s try to write data to a Block 1 of Sector 0. With the ‘0’ selected in the Sector combo box, select ‘1’ in the Block combo box. Enter the data (00112233445566778899AABBCCDDEEFF in this case) to be written in the general textbox for Block 1. Then, press the Write Block button.
Figure 14: Direct write operation of MiFare card
*Block 3 of each sector is known as Sector trailer of that sector and contains important information like Key B, Access bits, and Key A.
*Sector trailer can be read and written as other block, but bear in mind, writing incorrect value to Access bits and Keys might permanently lock the sector, losing all 4 blocks of memory.
17. As the writing operation is successful, let’s try to read the Sector 0 again. Now, users will discover that Block 1 of Sector 0 has been updated with the data written.
18. Besides the direct read and direct write operation, users can also store value in blocks in memory of MiFare card which giving flexibility to perform operations like increment decrement to a value stored in particular block of a particular sector. This can be executed under the Purse Function group box.
Figure 15: Store value in a Block of particular sector in memory of MiFare card
*Using the Purse Function, a value is stored in a distinct format in a block in memory of MiFare card. This can be seen when the direct read to Block 2 of Sector 0 is executed in the Operation Window.
Figure 16: Distinct format for value stored in a data block
20. To read back the value stored in particular block of particular sector, under the Purse Function group box, simply enter desired sector in Sector combo box and desired block in Block combo box. Make sure the KeyA checkbox is checked and enter the default authentication key FFFFFFFFFFFF in the Key textbox. Lastly, press the Balance button to read the stored value. The value read will be shown in both Value (Dec) and Value (Hex) textboxes.
21. Now, let’s try to perform operations like increment and decrement to the value stored in Block 2 of Sector 0. For the increment operation, with the Sector 0 and Block 2 still selected in the combo boxes, enter the value (’30’ in this case) for increment in the Value (Dec) textbox and then press the Increment button once.
Figure 17: Execute increment operation
22. Then, press the Balance button to read back the value stored in Block 2 of Sector 0. Users will discover that the value has been updated from the former value (100 in decimal) to current value (130 in decimal) after increment of 30 in decimal.
Figure 18: Updated value after increment operation
23. For the decrement operation, with the Sector 0 and Block 2 still selected in the combo boxes, enter the value (’20’ in this case) for decrement in the Value (Dec) textbox and then press the Decrement button once.
Figure 19: Execute decrement operation
24. Then, press the Balance button to read back the value stored in Block 2 of Sector 0. Users will discover that the value has been updated from the former value (130 in decimal) to current value (110 in decimal) after decrement of 20 in decimal.
Figure 20: Updated value after decrement operation
25. Finally, if there is no any further operation to be executed on the selected MiFare card, to deactivate it, with the card placed at the top of the MiFare reader/writer, press the Halt button at the top of the Purse Function group box.
That’s all for tutorial of Demonstration on GUI Software of the MiFare Reader/Writer CR038. See you next time!