MOD-RFID1356MIFARE

Revision as of 03:33, 23 May 2017 by LubOlimex (talk | contribs) (Changelog)

MOD-RFID1356MIFARE

Description

MOD-RFID1356MIFARE is an Olimex device that allows you to read and write NFC / MIFARE RFID tags operating at 13.56Mhz. MOD-RFID1356MIFARE uses NXP PN532 to read and write NFC / MIFARE RFID cards. In addition we put second microcontroller on the board which allow 3 additional ways to communicate with host device: USB HID keyboard, USB CDC Serial communication and UART CMOS level for UEXT boards.

Operation

Plug the board to your personal computer via mini USB cable. The green LED would start to blink.

The board can operate in the following user modes:

  • USB-HID - acts as human interface device, prints the ID of the read tags in a text field
  • UART - allows connection to equipment via the serial cable at the UEXT, allows usage of different commands at fixed baud rate of 38400
  • USB-CDC - same as above but via the mini USB port and can work up to 115200


Additionally there is another one:

  • Bootloader mode - used to upgrade the firmware


Once the board is powered you can change the mode of operating. Changing the mode of operation is done by holding the side button for at least 2 seconds. Depending on the behavior of the LEDs when the button is pressed you can predict the mode that the board would enter upon releasing the button. The combinations of LED behavior during a button press and board mode after button release are:

  • Only green led is blinking,: USB-CDC mode
  • Both green and red leds are blinking: UART mode
  • Only red led is blinking: USB-HID mode


Bootloader mode

In order to enter bootloader mode:

1. Disconnect the board from the mini USB cable;

2. Press and hold the button;

3. Apply the mini USB cable;

4. Wait at least 2 seconds and release the button.

After that you'll see both leds blinking one after another for a few seconds. In this mode you can upload new firmware.

Uploading new firmware

New versions of the firmware can be downloaded to the board via the mini USB connector from your personal computer with the help of a serial terminal software without the need of additional hardware.

To update the firmware we need a couple of software resources:

1.1. First install serial terminal software that is capable of sending files via the serial connection. We used the open source TeraTerm software here, and this is the terminal software that I would recommend under Windows. The web-page of TeraTerm is here: https://ttssh2.osdn.jp/index.html.en

Linux guys should use software terminal that supports XMODEM transfer.

The serial baud rate for updating the firmware should be 19200.

1.2. Download the archive with the latest firmware that is provided by Olimex. In the archive you can find this description, the firmware img and some pictures. Link to the archive:

https://drive.google.com/open?id=0BwplT87k9SCgcWs4VzJTeDhTcUU

At this point all software requirements are already available at the PC! Proceed:

2.1. Enter the MOD-RFID1356MIFARE board in bootloader mode as described in the previous chapter.

2.2. Open "Windows Device Manager" and identify the COM port that the board created. It is in the "Ports (COM & LPT)" section. Remember the COM port number or keep the manager open for a quick reference.

2.3. (optional) If the board is listed in "Ports (COM & LPT)" but reports that the it is unrecognized, then you would need to install a driver. The driver files are located in folder "2.WINDOWS_DRIVER" - in order to install the driver point manually to to folder inf file. It usually goes like this: right-click over the entry for the unit in "Windows Device Manager" –> "Update Driver Software" –> "Browse My Computer For Driver Software" –> "Let me pick from a list of device drivers on my computer" –> mark the entry of the RFID unit –> "Have Disk" –> "Browse" –> point to olimexvirser.inf –> "Open" –> "OK" –> "Next" –> if a warning pops-up ignore it –> "Finish". You might need to disable "Windows Driver Signature" enforcement if the unit still gets blocked.

2.4. Start TeraTerm

2.5. Select the bottom radio button "Serial" and select the COM port identified in point 2.2. Click "OK"

2.6. You would establish a connection with the board and you would see "CCCC..." coming from the board. This means that the board is ready to receive new firmware.

2.7. Navigate to "File" -> "Transfer" -> "XMODEM" -> "Send..."; this would bring an explorer window and we have to point to the img file that contains the firmware. It is located in folder "FIRMWARE IMAGES" of the folder that you downloaded in point 1.2.

2.8. Once the download is complete, wait for a few seconds and power cycle the board (remove the USB cable, wait a few seconds, plug it back in). Your board now has the latest firmware.

Firmware releases

103 - Latest release (recommended) - fixed delay bug; several minor improvements: download link

102 - Third release - added compatibility for MIFARE Ultralight and MIFARE Ultralight EV1 tags; several other improvements: download link

101 - Second release - several improvements and fixes over release 100; most notably fixed unavailability for reading tags with EEPROM different from FF:FF:FF:FF:FF:FF:FF:FF: download link

100 - Initial release (not recommended): download link

USB-HID mode

The device is shown as keyboard. On Linux machine you should see something like this:

# dmesg

usb 3-2: new full-speed USB device number 45 using uhci_hcd
usb 3-2: New USB device found, idVendor=15ba, idProduct=0039
usb 3-2: New USB device strings: Mfr=1, Product=3, SerialNumber=4
usb 3-2: Product: MOD-RFID1356MIFARE Tag Keyboard
usb 3-2: Manufacturer: Olimex Ltd.
usb 3-2: SerialNumber: xxxxxxxxxxxxxxx
input: Olimex Ltd. MOD-RFID1356MIFARE Tag Keyboard as /devices/pci0000:00/0000:00:1d.1/usb3/3-2/3-2:1.0/0003:15BA:0039.000D/input/input16
hid-generic 0003:15BA:0039.000D: input,hidraw3: USB HID v1.11 Keyboard [Olimex Ltd. MOD-RFID1356MIFARE Tag Keyboard] on usb-0000:00:1d.1-2/input0

How to use it?

Open some text editor and approach card to the reader, you will see RFID-card UUID typed as if entered by keyboard.

Note that state of your keyboard CAPSLOCK, SHIFT, CONTROL etc buttons will affect what is typen. For instance if the tag info is 74bc3eb7 and you press CAPSLOCK the reader will type 74BC3EB7, if SHIFT is pressed the reader will type &$BC#EB&

USB-CDC mode

When you switch to this mode, you'll see:

# dmesg

usb 3-2: new full-speed USB device number 46 using uhci_hcd
usb 3-2: New USB device found, idVendor=15ba, idProduct=003a
usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=4
usb 3-2: Product: MOD-RFID1356MIFARE
usb 3-2: Manufacturer: Olimex Ltd.
usb 3-2: SerialNumber: xxxxxxxxxxxxxxx
cdc_acm 3-2:1.0: ttyACM0: USB ACM device

As you can see a new device /dev/ttyACM0 was created. If can be opened by any terminal emulator such as putty, minicom, etc. Since the device is USB-CDC it supports various baud rates - up to 115200.

Open device:

# picocom -b 115200 /dev/ttyACM0

Press Enter and you'll see cursor marker:

>
>

To see help enter ?:

>?
MOD-RFID1356MIFARE
Brief command list and usage description:
 i - information.
 ? - this help.
 b - Switch to bootloader.

 erB - Read data in block B.
 erS,E - Read data from block S to block E.
 ewB,X - Write data to block B. X must be hex, maximum 16 bytes.
 e0 - Disable eeprom read.
 e1 - Enable eeprom read.
 mlE - Set led mode to disabled (E=0) or enabled (E=1)
 mtF - Set scan interval. Values between 1 and 30000 are accepted.
 mkK - Set work key, (K=a) for Key_A or (K=b) for Key_B.
 kA - Read current key, where A is 'a' or 'b'.
 kA,X - Set new key, where A is 'a' or 'b'. X is 6 bits in hex format.

Usage if the commands is as follow:

  • i - information - Prints current firmware release:
>i
MOD-RFID1356MIFARE
Firmware revision: 01.01
http://www.olimex.com
  • ? - this help - Print help commands<
  • b - Switch to bootloader. Go into bootloader mode:
>b
Device is entering boot loader mode...
FATAL: term closed

After this terminal will close and board will go to bootloader mode.

  • erB - Read data in block B. This will read 16 bytes from block B. Usually card have up to 64 blocks. For example to read what is stored in block 10 type:
>er0,7

Next time when you check card this will pop:

-1E68EFA6
Block   0 : 1E 68 EF A6 3F 88 04 00 47 B9 94 D6 45 30 36 09 
Block   1 : 12 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
Block   2 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
Block   3 : 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF 
Block   4 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
Block   5 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
Block   6 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
Block   7 : 00 00 00 00 00 00 FF 07 80 69 FF FF FF FF FF FF 
OK
>
  • eWB,X - Write data to block B. X must be hex, maximum 16 bytes. This will write hex number to EEPROM. Again your card should NOT be locked. To write 0x1234 to block 9:
>ew9,1234
OK

Write will be executed only once. When you check card:

>er9
-1E68EFA6
Block   9 : 12 34 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
OK

The remaining unused bytes are replaced with F.

  • e0 - Disable eeprom read.
-74BC3EB72
Block   9 : 12 34 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
OK
>e0
>
-74BC3EB7
-74BC3EB7
-74BC3EB7
  • e1 - Enable eeprom read.
>e1
>
-74BC3EB72
Block   9 : 12 34 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
OK
-74BC3EB72
Block   9 : 12 34 FF FF FF FF FF FF FF FF FF FF FF FF FF FF 
OK

mlE - Set led mode to disabled (E=0) or enabled (E=1) To enable leds:

>ml1
OK

To disable leds:

>ml0
OK
  • mtF - Set scan interval. Values between 1 and 30000 are accepted Defines scanning interval for near cards. If you want 1 second between scans:
>mt1000
OK
  • mkA - mkK - Set work key, (K=a) for Key_A or (K=b) for Key_B. Key B is optional for some cards.
>mka
OK
  • kA,X - Set new key, where A is 'a' or 'b'. X is 6 bits in hex format
>ka,112233445566
OK
  • kA - Read current key, where A is 'a' or 'b'.
>ka
Key A : 112233445566
OK

UART mode

The commands are the same as in USB-CDC mode. The difference is connection method and fixed baud-rate.

Connect the USB serial converter as follows:

  • UEXT pin 2 (GND) -> GND
  • UEXT pin 3 (RX) -> Convertor TX
  • UEXT pin 4 (TX) -> Convertor RX


Open serial port at baud-rate 38400:

# picocom -b 38400 /dev/ttyUSB0

>?
MOD-RFID1356MIFARE
Brief command list and usage description:
 i - information.
 ? - this help.
 b - Switch to bootloader.

 erB - Read data in block B.
 ewB,X - Write data to block B. X must be hex, maximum 16 bytes.
 e0 - Disable eeprom read.
 e1 - Enable eeprom write.
 mlE - Set led mode to disabled (E=0) or enabled (E=1)
 mtF - Set scan interval. Values between 1 and 30000 are accepted.

Changelog

Version 1.0.0 (24 MAY 2016)

  • Initial release

Version 1.0.1 (29 SEP 2016)

  • Increased UART baudrate to 38400
  • Added option for selecting authentication key

Version 1.0.2 (3 APR 2017)

  • Added support for Ultraligth tags
  • Fixed some typos

Version 1.0.3 (27 APR 2017)

  • Fixed delay bug

Known firmware issues

Only in USB-CDC mode: if you are in USB-CDC mode, and the virtual COM port is not open, and you attempt to read a tag - the unit would restart and the "USB number" would increase. Workaround - ensure that you open the virtual COM port as soon as it is available and before putting a tag near the reader.