User's Manual

17 | P a g e www.eccel.co.uk
3.3 Mifare Classics commands
This set of commands should be performed on Mifare Classics tags.
3.3.1 Read block (0x20)
The read block command should be used to read data from the tag. It takes as arguments the block number
of the first block to read, the number of blocks to read, the key A or B parameter, and the key number in
key storage. The returned ACK answer contains data read from the specified tag memory. The number of
bytes of this data is Mifare Classic block size (16) multiplied by the number of blocks to be read.
Command description
Argument
Size
Value
Description
Command ID
1
0x20
MF_READ_BLOCK
Block number
1
X
Number of blocks
1
Y
Key A/B parameter 1
X
0x0A
Key A should be selected from key storage
0x0B – Key B should be selected from key storage
Key number
1
0
-
4
Key number in key storage
Response
description
ACK
1
0x00
Command ID
1
0x20
MF_READ_BLOCK
Read data Y*16 XXX
Bytes read from the tag. Number of bytes is number of
requested blocks multiplied by 16.
Example:
HOST=>READER: 0x20 – MF_READ_BLOCK
0x02 – block number 2
0x02 – two blocks to read
0x0A – key A should be selected from key storage
0x00 – first key should be selected from key storage
READER=>HOST: 0x00 – ACK byte
0x20 – related command code MF_READ_BLOCK
0x01 0x2e 0x41 0x22 0x43 0x11 0x8e 0x20
0x31 0x38 0x20 0x32 0x30 0x31 0x39 0x41
0x81 0x23 0x42 0x28 0x33 0x01 0x8e 0x72
0x31 0x35 0x3a 0x33 0x35 0x3a 0x30 0x33 – 32 bytes
result
3.3.2 Write block (0x21)
The write block command should be used to write data to the tag. It takes as arguments the block number
of the first block to write, the number of blocks to write, the key A or B parameter, the key number in key
storage, and the bytes to be written. The number of bytes to be written must be exactly the number of
blocks to write multiplied by 16. If the host receives an ACK without any errors means the write process
was successful and the data was read back and verified as correct by the reader.