Api Acr1222l 2.01
Api Acr1222l 2.01
NFC Reader
with LCD
Application Programming Interface V2.01
Page 2 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Table of Contents
1.0. Introduction ............................................................................................................. 5
2.0. Features ................................................................................................................... 6
3.0. Architecture ............................................................................................................. 7
3.1 Reader Block Diagram ........................................................................................................... 7
3.2 Communication among the PC/SC Driver, PICC and SAM .................................................. 8
4.0. Hardware Design ..................................................................................................... 9
4.1 USB ........................................................................................................................................ 9
4.1.1 Communication Parameters .................................................................................................... 9
4.1.2 Endpoints ................................................................................................................................. 9
4.2 Contact Smart Card Interface ................................................................................................ 9
4.2.1 Smart Card Power Supply VCC (C1) ...................................................................................... 9
4.2.2 Card Type Selection ................................................................................................................ 9
4.2.3 Interface for Microcontroller-based Cards .............................................................................10
4.3 Contactless Smart Card Interface .......................................................................................10
4.3.1 Carrier Frequency ..................................................................................................................10
4.3.2 Card Polling ...........................................................................................................................10
4.4 User Interface ......................................................................................................................10
4.4.1 Buzzer....................................................................................................................................10
4.4.2 LED 10
5.0. Contactless Smart Card Protocol ......................................................................... 11
5.1 ATR Generation ...................................................................................................................11
5.1.1 ATR format for ISO 14443 Part 3 PICCs ...............................................................................11
5.1.2 ATR format for ISO 14443 Part 4 PICCs ...............................................................................12
5.2 Pseudo APDUs for Contactless Interface ............................................................................13
5.2.1 Direct Transmit via PC_to_RDR_Escape ..............................................................................13
5.2.2 Get Data ................................................................................................................................14
5.2.3 PICC Commands (T=CL Emulation) for MIFARE 1K/4K Memory Cards ..............................15
5.2.4 Access PC/SC Compliant Tags (ISO 14443-4) .....................................................................24
6.0. Peripherals Control ............................................................................................... 25
6.1 Get Firmware Version ..........................................................................................................25
6.2 Buzzer Control .....................................................................................................................26
6.3 Get Serial Number of the reader .........................................................................................27
6.4 Read the PICC Operating Parameter ..................................................................................28
6.5 Set PICC Operating Parameter ...........................................................................................29
6.6 2 LEDs Control ....................................................................................................................30
6.7 4 LEDs Control ....................................................................................................................31
6.8 Set Default LED and Buzzer Behaviors ...............................................................................32
6.9 Read Default LED and Buzzer Behaviors ...........................................................................33
6.10 Store 1st Data Storage Area.................................................................................................34
6.11 Store 2nd Data Storage Area ................................................................................................35
6.12 Read 1st Data Storage Area.................................................................................................36
6.13 Read 2nd Data Storage Area ................................................................................................37
6.14 LCD Control Command .......................................................................................................38
6.14.1 Clear LCD ............................................................................................................................38
6.14.2 LCD Display (ASCII Mode) ..................................................................................................38
6.14.3 LCD Display (GB Mode) ......................................................................................................40
6.14.4 LCD Display (Graphic Mode)...............................................................................................41
6.14.5 LCD Create Word ................................................................................................................44
6.14.6 Scroll Current LCD Display..................................................................................................45
6.14.7 LCD Contrast Control ..........................................................................................................46
6.14.8 LCD Backlight Control .........................................................................................................47
Page 3 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix A. Basic Program Flow for Contactless Applications ................................. 48
Appendix B. Access PCSC Compliant Tags (ISO 14443-4).......................................... 49
Appendix C. Access MIFARE DESFire Tags (ISO 14443-4) ......................................... 51
Appendix D. Access FeliCa Tags (ISO 18092) .............................................................. 53
Appendix E. NFC Forum Type 1 Tags (ISO 18092) ....................................................... 54
Appendix F. Basic Program Flow for SAM Applications ............................................. 56
Appendix G. Access ACOS3 SAM Cards (ISO 7816).................................................... 57
Appendix H. ACR122U Compatible Commands ........................................................... 58
Appendix H.1. Direct Transmit via PC_to_RDR_XfrBlock/PC_to_RDR_Escape ..............................58
Appendix H.2. Get Firmware Version ................................................................................................58
Appendix H.3. Get PICC Operating Parameter .................................................................................59
Appendix H.4. Set the PICC Operating Parameter ............................................................................60
Appendix I. LCD Program example ............................................................................... 61
Appendix I.1. LCD horizontal Scrolling ..............................................................................................61
List of Figures
Figure 1 : Reader Block Diagram ........................................................................................................... 7
Figure 2 : ACR1222L Architecture ......................................................................................................... 8
List of Tables
Table 1 : USB Interface Wiring ............................................................................................................... 9
Table 2 : Buzzer Event ......................................................................................................................... 10
Table 3 : MIFARE 1K Memory Map ...................................................................................................... 17
Table 4 : MIFARE 4K Memory Map ...................................................................................................... 17
Table 5 : MIFARE Ultralight Memory Map ............................................................................................ 18
Page 4 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
1.0. Introduction
The ACR1222L NFC Reader with LCD is a PC-linked device that is used for accessing contactless
cards. Its contactless interface is used to access ISO 14443-4 Types A and B cards, MIFARE®,
FeliCa, and ISO 18092 or NFC tags. ACR1222L also has three Secure Access Module (SAM) slots
which can be used with ISO 7816 compliant Class A SAM cards to add a layer of security for
contactless smart card applications.
ACR1222L serves as an intermediary device between the computer and the smart card. The reader is
connected to the computer via USB port and carries out the commands whether to communicate with
a contactless tag or SAM card, or control the device peripherals (LCD, LED or buzzer). This API
document provides a detailed guide on implementing PC/SC APDU commands for device peripherals
and contactless tags following the PC/SC Specifications.
Page 5 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
2.0. Features
USB Full Speed Interface
CCID-compliance
Smart Card Reader:
o Contactless Interface:
Read/Write speed of up to 424 kbps
Built-in antenna for contactless tag access, with card reading distance of up to 50 mm
(depending on tag type)
Support for ISO 14443 Part 4 Type A and B cards, MIFARE, FeliCa and all four types
of NFC (ISO/IEC 18092) tags
Built-in anti-collision feature (only one tag is accessed at any time)
o SAM Interface:
Three SAM slots
Supports ISO 7816-acompliant Class A SAM cards
Application Programming Interface:
o Supports PC/SC
o Supports CT-API (through wrapper on top of PC/SC)
Built-in Peripherals:
o Two-line graphic LCD with multi-language support (i.e. Chinese, English, Japanese and
several European languages)
o Four user-controllable LEDs
o User-controllable buzzer
USB Firmware Upgradability
Supports Android™ 3.1 and later 1
Page 6 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
3.0. Architecture
3.1 Reader Block Diagram
Page 7 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
3.2 Communication among the PC/SC Driver, PICC and SAM
The protocol between the ACR1222L and the PC is using CCID protocol. All the communication
between PICC and SAM are PC/SC compliant.
Page 8 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
4.0. Hardware Design
4.1 USB
The ACR1222L connects to a computer through a USB following the USB standard.
Note: In order for the ACR1222L to function properly through USB interface, the device driver should
be installed.
4.1.2 Endpoints
The ACR1222L uses the following endpoints to communicate with the host computer:
Control Endpoint For setup and control purpose
Bulk OUT For command to be sent from host to ACR1222L (data packet size is 64
bytes)
Bulk IN For response to be sent from ACR1222L to host (data packet size is 64
bytes)
Interrupt IN For card status message to be sent from ACR1222L to host (data packet size
is 8 bytes)
Page 9 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
4.2.3 Interface for Microcontroller-based Cards
For microcontroller-based smart cards only the contacts C1 (VCC), C2 (RST), C3 (CLK), C5 (GND)
and C7 (I/O) are used. A frequency of 4 MHz is applied to the CLK signal (C3).
Events Buzzer
1. The reader powered up and initialization success. Beep
2. Card Present Event (PICC) Beep
3. Card Removal Event (PICC) Beep
4.4.2 LED
4 x user-controllable single-color LEDs
LED colors are: Green, Blue, Orange and Red (from left to right)
Page 10 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.0. Contactless Smart Card Protocol
5.1 ATR Generation
If the reader detects a PICC, an ATR will be sent to the PC/SC driver for identifying the PICC.
Example:
ATR for MIFARE 1K = {3B 8F 80 01 80 4F 0C A0 00 00 03 06 03 00 01 00 00 00 00 6Ah}
Where:
Length (YY) = 0Ch
RID = A0 00 00 03 06h (PC/SC Workgroup)
Standard (SS) = 03h (ISO 14443A, Part 3)
Card Name (C0 ... C1) = 00 01h (MIFARE 1K)
00 02h: MIFARE 4K
00 03h: MIFARE Ultralight
00 26h: MIFARE Mini
F0 04h: Topaz and Jewel
Page 11 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
F0 11h: FeliCa 212K
F0 12h FeliCa 424K
FF 28h: JCOP 30
FFh [SAK]: undefined tags
ISO 14443A:
The historical bytes from ATS response. Refer
to the ISO 14443-4 specifications.
XXh
4 to 3 + N
XXh Tk
ISO 14443B:
XXh
The higher layer response from the ATTRIB
response (ATQB). Refer to the ISO 14443-3
specifications.
Page 12 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2 Pseudo APDUs for Contactless Interface
The following Pseudo APDUs are used for exchanging data with non-PC/SC compliant tags. Pseudo
APDUs can be sent through the PICC Interface is the tag is already connected or sent using Escape
Command if the tag is not yet presented.
Where:
Lc: 1 Byte. Number of Bytes to Send
- Maximum of 255 bytes
Data In: Contactless Chip and Tag Command
The data to be sent to the Contactless Chip and Tag
Response
Where:
Data Out: Contactless Chip and Tag Response
Contactless Chip and Tag Response returned by the reader
Page 13 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.2 Get Data
This command is used to return the serial number or ATS of the “connected PICC”.
Command
Response if P1 = 00h
Response if P1 = 01h
Response Codes
Page 14 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3 PICC Commands (T=CL Emulation) for MIFARE 1K/4K Memory Cards
Command
Where:
Key Structure: 1 Byte
00h = Key is loaded into the reader volatile memory
Other = Reserved
Key Number: 1 Byte
00h – 01h = Key Location
The keys will be erased when the reader is disconnected from the PC
Key: 6 Bytes
The key value loaded into the reader
e.g. {FF FF FF FF FF FFh}
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Example:
Load a key {FF FF FF FF FF FFh} into the key location 00h.
APDU = {FF 82 00 00 06 FF FF FF FF FF FFh}
Page 15 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3.2 Authentication for MIFARE 1K/4K
This command is used to authenticate the MIFARE 1K/4K card (PICC) using the keys stored in the
reader. Two types of authentication keys are used Type_A and Type_B.
Command
Command
Where:
Authenticate Data Bytes: 5 Bytes
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Page 16 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Sectors Trailer Block
Data Blocks
(Total 16 sectors. Each (1 block, 16 bytes)
(3 blocks, 16 bytes per
sector consists of 4
block)
consecutive blocks)
Sector 0 00h ~ 02h 03h
Sector 1 04h ~ 06h 07h
..
1K
.. Bytes
Sector 14 38h ~ 0Ah 3Bh
Sector 15 3Ch ~ 3Eh 3Fh
Example1: To authenticate Block 04h with the following characteristics: Type A, key number
00h, from PC/SC V2.01 (Obsolete).
APDU = { FF 88 00 04 60 00h }
Page 17 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Example2: Similar to the previous example, to authenticate Block 04h with the following
characteristics: Type A, key number 00h, from PC/SC V2.07.
APDU = { FF 86 00 00 05 01 00 04 60 00h }
Note: MIFARE Ultralight does not need authentication since it provides free access to the
user data area.
Page 18 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3.3 Read Binary Blocks
This command is used to retrieve multiple “data blocks” from the PICC. The data block/trailer must be
authenticated first before executing the “Read Binary Blocks” command.
Command
Where:
Block Number: 1 Byte. Starting Block
Number of Bytes to Read: 1 Byte. The length of the bytes to be read can be a multiple
of 16 bytes for MIFARE 1K/4K or a multiple of 4 bytes for
MIFARE Ultralight
Maximum of 16 bytes for MIFARE Ultralight
Maximum of 48 bytes for MIFARE 1K. (Multiple Blocks Mode;
3 consecutive blocks)
Maximum of 240 bytes for MIFARE 4K. (Multiple Blocks
Mode; 15 consecutive blocks)
Example 1: 10h (16 bytes). The starting block only (Single Block Mode)
Example 2: 40h (64 bytes). From the starting block to starting block + 3 (Multiple Blocks
Mode)
Note: For security considerations, the Multiple Block Mode is used for accessing Data Blocks
only. The Trailer Block is not supposed to be accessed in Multiple Blocks Mode. Please use
Single Block Mode to access the Trailer Block.
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Example 1: Read 16 bytes from the binary block 04h (MIFARE 1K or 4K)
APDU = { FF B0 00 04 10h }
Example 2: Read 240 bytes starting from the binary block 80h (MIFARE 4K). Block 80h to Block
8Eh (15 blocks)
APDU = { FF B0 00 80 F0h }
Page 19 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3.4 Update Binary Blocks
This command is used to write multiple data blocks into the PICC. The data block/trailer block must be
authenticated first before executing the “Update Binary Blocks” command.
Command
Where:
Block Number: 1 Byte. Starting Block
Number of Bytes to Read: 1 Byte. The length of the bytes to be read can be a multiple
of 16 bytes for MIFARE 1K/4K or a multiple of 4 bytes for
MIFARE Ultralight
Maximum of 16 bytes for MIFARE Ultralight
Maximum of 48 bytes for MIFARE 1K. (Multiple Blocks Mode;
3 consecutive blocks).
Maximum of 240 bytes for MIFARE 4K. (Multiple Blocks
Mode; 15 consecutive blocks).
Example 1: 10h (16 bytes). The starting block only. (Single Block Mode)
Example 2: 30h (48 bytes). From the starting block to starting block+2. (Multiple Blocks
Mode)
Note: For security considerations, the Multiple Block Mode is used for accessing Data Blocks
only. The Trailer Block is not supposed to be accessed in Multiple Blocks Mode. Please use
Single Block Mode to access the Trailer Block.
Block Data: Multiple of 16 + 2 Bytes, or 6 Bytes. Data to be written into the binary blocks.
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Example 1: Update the binary block 04h of MIFARE 1K/4K with Data {00 01h .. 0Fh}
APDU = { FF D6 00 04 10 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0Fh }
Example 2: Update the binary block 04h of MIFARE Ultralight with Data { 00 01 02 03h }
APDU = {FF D6 00 04 04 00 01 02 03h }
Page 20 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3.5 Value Block Operation (Increment, Decrement, Store)
This command is used to manipulate value-based transactions (e.g. increment a value block, etc.).
Command
Where:
Block Number: 1 Byte. Value Block to be manipulated
VB_OP: 1 Byte. Value block operation
00h = Store VB_Value into the block. The block will then be converted to a
value block.
01h = Increment the value of the value block by the VB_Value. This
command is only valid for value blocks.
02h = Decrement the value of the value block by the VB_Value. This
command is only valid for value blocks.
VB_Value: 4 Byte. The value used for manipulation. The value is a signed long integer.
VB_Value
MSB LSB
FFh FFh FFh FCh
VB_Value
MSB LSB
00h 00h 00h 01h
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Page 21 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3.6 Read Value Block
This command is used to retrieve the value from the value block. This command is only valid for value
blocks.
Command
Where:
Block Number: 1 Byte. The value block to be accessed.
Response
Response
Where:
Value: 4 Bytes. The value returned from the cards. The value is a signed long
integer.
Example 1: Decimal - 4 = { FF FF FF FCh }
VB_Value
MSB LSB
FFh FFh FFh FCh
VB_Value
MSB LSB
00h 00h 00h 01h
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Page 22 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.3.7 Copy Value Block
This command is used to copy a value from a value block to another value block.
Command
Where:
Source Block Number: 1 Byte. Block number where the value will come from and copied to
the target value block.
Target Block Number: 1 Byte. Block number where the value from the source block will be
copied to. The source and target value blocks must be in the same
sector.
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Page 23 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
5.2.4 Access PC/SC Compliant Tags (ISO 14443-4)
All ISO 14443-4 compliant cards (PICCs) understand the ISO 7816-4 APDUs. The ACR1222L Reader
needs to communicate with the ISO 14443-4 compliant cards through exchanging ISO 7816-4 APDUs
and Responses. ACR1222U will handle the ISO 14443 Parts 1-4 Protocols internally.
The MIFARE 1K, 4K, MINI and Ultralight tags are supported through the T=CL emulation. Just simply
treat the MIFARE tags as standard ISO 14443-4 tags. For more information, please refer to PICC
Commands (T=CL Emulation) for MIFARE 1K/4K Memory Cards.
Command
Response
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
Typical sequence may be:
Present the Tag and Connect the PICC Interface
Read / Update the memory of the tag
Page 24 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.0. Peripherals Control
The reader’s peripherals control commands are implemented by using PC_to_RDR_Escape. The
vendor IOCTL for the escape commands is 3500.
Command
Response
Example:
Response = E1 00 00 00 12 41 43 52 31 32 32 32 4C 2D 55 20 56 33 31 33 2E 30 31 h
Firmware Version (HEX) = 41 43 52 31 32 32 32 4C 2D 55 20 56 33 31 33 2E 30 31 h
Firmware Version (ASCII) = “ACR1222L-U V307.1”
Page 25 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.2 Buzzer Control
This command is used to control the buzzer output.
Command
Where:
Buzzer On Duration: 1 Byte
01 – FFh = Duration (unit: 10 ms)
Response
Where:
Timer: 1 Byte
The value is the MCU’s timer and is not to be used in the application.
Page 26 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.3 Get Serial Number of the reader
This command is used to retrieve the serial number of the reader.
Command
Response
Where:
Serial Number: 16 Bytes
The value is the serial number of the reader.
Page 27 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.4 Read the PICC Operating Parameter
This command is used to check current PICC Operating Parameter.
Command
Response
Where:
Operating Parameter: 1 Byte
Operating
Parameter Description Option
Parameter
ISO 14443 1 = Detect
Bit 0 The tag types to be
Type A 0 = Skip
detected during
ISO 14443 PICC Polling 1 = Detect
Bit 1
Type B 0 = Skip
Bit 2 – 7 RFU RFU RFU
Page 28 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.5 Set PICC Operating Parameter
The command is used to set the PICC Operating Parameter.
Command
Response
Where:
Operating Parameter: 1 Byte. Default value = 03h
Operating
Parameter Description Option
Parameter
1 = Detect
Bit 0 ISO 14443 Type A The tag types to be 0 = Skip
detected during PICC
Polling 1 = Detect
Bit 1 ISO 14443 Type B
0 = Skip
Bit 2 – 7 RFU RFU RFU
Page 29 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.6 2 LEDs Control
This command is used to control the first 2 LEDs.
Command
Response
Where:
LED Status: 1 Byte
Page 30 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.7 4 LEDs Control
This command is used to control the 4 LEDs.
Command
Where:
P2: 1 Byte. bLEDsState.
Page 31 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.8 Set Default LED and Buzzer Behaviors
This command is used to set the default behavior of the LEDs and buzzer.
Note: This command is supported by firmware version 312 and above only.
Command
Where:
Default Behavior: Default value = 8Fh (1 Byte)
Operating
Description Option
Parameter
Bit 0 RFU RFU
To show the PICC polling status.
Bit 1 PICC Polling Status LED 1 = Enable
0 = Disable
Bit 2 RFU RFU
Bit 3 RFU RFU
To make a beep whenever a card insertion
Card Insertion and Removal or removal event is detected (for PICC).
Bit 4
Events Buzzer 1 = Enable
0 = Disable
To make a beep when the contactless chip
Contactless Chip Reset is reset.
Bit 5
Indication Buzzer 1 = Enable
0 = Disable
Bit 6 RFU RFU
To blink the LED whenever the PICC is
being accessed.
Bit 7 Card Operation Blinking LED
1 = Enable
0 = Disable
Response
Page 32 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.9 Read Default LED and Buzzer Behaviors
This command is used to set the read the current default behaviors of LEDs and buzzer.
Note: This command is supported by firmware version 312 and above only.
Command
Response
Where:
Behavior: 1 Byte
Operating
Description Option
Parameter
Bit 0 RFU RFU
To show the PICC polling status.
Bit 1 PICC Polling Status LED 1 = Enable
0 = Disable
Bit 2 RFU RFU
Bit 3 RFU RFU
To make a beep whenever a card
insertion or removal event is detected
Card Insertion and (for PICC).
Bit 4
Removal Events Buzzer
1 = Enable
0 = Disable
To make a beep when the contactless
Contactless Chip Reset chip is reset.
Bit 5
Indication Buzzer 1 = Enable
0 = Disable
Bit 6 RFU RFU
To blink the LED whenever the PICC is
Card Operation Blinking being accessed.
Bit 7
LED 1 = Enable
0 = Disable
Page 33 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.10 Store 1st Data Storage Area
This command is used to store a data to 1st Data Storage Area (up to 256 Bytes).
Command
Where:
Data Len (MSB): The high byte of the data length
Data Len (LSB): The low byte of the data length
Response
Page 34 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.11 Store 2nd Data Storage Area
This command is used to store a data to 2nd Data Storage Area (up to 256 Bytes).
Command
Data Data
Store 2nd Data
FFh 00h 4Bh 00h 00h Len Len Data
Storage
(MSB) (LSB)
Where:
Data Len (MSB): The high byte of the data length
Data Len (LSB): The low byte of the data length
Page 35 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.12 Read 1st Data Storage Area
This command is used to read a data from 1st Data Storage Area (up to 256 Bytes).
Command
Where:
Data Len (MSB): The high byte of the data length
Data Len (LSB): The low byte of the data length
Response
Results Data
Result Data return from the 1st Data Storage Area
Page 36 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.13 Read 2nd Data Storage Area
This command is used to read a data from 2nd Data Storage Area (up to 256 Bytes).
Command
Where:
Data Len (MSB): The high byte of the data length
Data Len (LSB): The low byte of the data length
Response
Results Data
Result Data return from the 2nd Data Storage Area
Page 37 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.14 LCD Control Command
6.14.1 Clear LCD
This command is used to clear all contents shown on the LCD.
Command
Response
Command
Data In
Command Class INS P1 P2 Lc
(Max. 16Bytes)
LCD XY LCD Message
LCD Display FFh 00h 68h LCD Message
Position Length
Where:
P2: 1 Byte. LCD XY Position
The Character to be displayed on the LCD position specified by DDRAM Address
Please follow the DDRAM table below for the LCD character position’s representation:
Note: The length of the LCD message should multiple of 2
DISPLAY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
POSITION
1st
00 01 02 03 04 05 06 07
LINE LCD XY
2nd POSITION
40 41 42 43 44 45 46 47
LINE
Page 38 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Where:
Lc: LCD Message Length
The length of the LCD message (max. 10h); If the message length is longer than the
number of character that the LCD screen’s can be shown, then the redundant
character will not be shown on the LCD.
Note: The length of the LCD message should multiple of 2
Example 1:
Display 2 char (“56”) in display position 5 & 6 (XY Position 02h):
Send escape command:
<< FF 00 68 02 02 35 56
>> [90 00]
Example 2:
Display 2 char (“56”) in display position 6 & 7 (have to fill all the data in line 1 block 02 & 03):
Send escape command:
<< FF 00 68 02 04 20 35 36 20
>> [90 00]
Page 39 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.14.3 LCD Display (GB Mode)
This command is used to display LCD message in GB Mode.
Command
Data In
Command Class INS P1 P2 Lc
(Max. 16 Bytes)
LCD XY LCD Message
LCD Display FFh 00h 69h LCD Message
Position Length
Where:
DISPLAY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
POSITION
1st
00 01 02 03 04 05 06 07
LINE LCD XY
2nd POSITION
40 41 42 43 44 45 46 47
LINE
Response
Page 40 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.14.4 LCD Display (Graphic Mode)
This command is used to display LCD message in Graphic Mode.
Command
Data In
Command Class INS P1 P2 Lc
(must be 32 Bytes)
Block Pixel Data
LCD Display FFh 00h 6Ah 20h
Index {MSB .. LSB}
Where:
P2: Block Index
To set which block to start to update the LCD Display
DISPLAY
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
POSITION
1st
00 01 02 03 04 05 06 07
LINE LCD XY
2nd POSITION
40 41 42 43 44 45 46 47
LINE
Page 41 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
LCD Display Position (Total LCD Size: 128x32):
P2 = 0x00h … P2 = 0x07h
Lines
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 … 15 … 8 7 … 0
no.
0 date byte 1 date byte 2 date byte 1 date byte 2
1 date byte 3 date byte 4 date byte 3 date byte 4
2 date byte 5 date byte 6 date byte 5 date byte 6
3 date byte 7 date byte 8 date byte 7 date byte 8
4 date byte 9 date byte 10 date byte 9 date byte 10
5 date byte 11 date byte 12 date byte 11 date byte 12
6 date byte 13 date byte 14 date byte 13 date byte 14
1st 7 date byte 15 date byte 16 date byte 15 date byte 16
Line 8 date byte 17 date byte 18 date byte 17 date byte 18
9 date byte 19 date byte 20 date byte 19 date byte 20
10 date byte 21 date byte 22 date byte 21 date byte 22
11 date byte 23 date byte 24 date byte 23 date byte 24
12 date byte 25 date byte 26 date byte 25 date byte 26
13 date byte 27 date byte 28 date byte 27 date byte 28
14 date byte 29 date byte 30 date byte 29 date byte 30
15 date byte 31 date byte 32 date byte 31 date byte 32
…
2nd
31 date byte 31 date byte 32 date byte 31 date byte 32
Line
Response
Page 42 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Example:
Graphic mode on XY position = 44 using below picture
Page 43 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.14.5 LCD Create Word
This command is used to create new customized word, total 50 characters can be created. The
created character will save to RAM, and the data will lose after disconnect to PC.
Command
Data In
Command Class INS P1 P2 Lc
(must be. 32 Bytes)
Word Pixel Data
LCD Display FFh 00h 65h 20h
Index {MSB .. LSB}
Where:
P2: Word Index
To save the pixel data to the GB Code.
The data will save to the code index in GB Table, and the saved character can be
displayed by using LCD Display (GB Mode).
The matching table of Character index and the GB character index:
Character GB character
index index
0x00 A0B0
0x01 A0B1
…
0x32 A0E2
Pixel data position:
Lines
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
no.
0 date byte 1 date byte 2
1 date byte 3 date byte 4
2 date byte 5 date byte 6
3 date byte 7 date byte 8
4 date byte 9 date byte 10
5 date byte 11 date byte 12
6 date byte 13 date byte 14
7 date byte 15 date byte 16
8 date byte 17 date byte 18
9 date byte 19 date byte 20
10 date byte 21 date byte 22
11 date byte 23 date byte 24
12 date byte 25 date byte 26
13 date byte 27 date byte 28
14 date byte 29 date byte 30
15 date byte 31 date byte 32
Page 44 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Example:
Page 45 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.14.7 LCD Contrast Control
This command is used to control the LCD contrast.
Command
Where:
Contrast Control: 1 Byte
The value range is between 00h to 0Fh. Larger value brightens the
contrast. Lower range, on the other hand, darkens the contrast.
Response
Page 46 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
6.14.8 LCD Backlight Control
This command controls the LCD Backlight.
Command
Where:
Backlight Control: 1 Byte
CMD Description
00h LCD Backlight Off
FFh LCD Backlight On
Response
Page 47 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix A. Basic Program Flow for Contactless
Applications
Step 0. Start the application. The reader will do the PICC Polling and scan for tags continuously. Once
the tag is found and detected, the corresponding ATR will be sent to the PC.
Step 1. Connect the ACR1222L PICC Interface with T=1 protocol.
Step 2. Access the PICC by exchanging APDUs.
..
Step N. Disconnect the ACR122L PICC Interface and close the application.
Page 48 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix B. Access PCSC Compliant Tags (ISO
14443-4)
All ISO 14443-4 compliant cards (PICCs) would understand the ISO 7816-4 APDUs. The ACR1222L
needs to communicate with the ISO 14443-4 compliant cards through exchanging ISO 7816-4 APDUs
and Responses. ACR1222L will handle the ISO 14443 Parts 1-4 Protocols internally.
MIFARE 1K, 4K, MINI and Ultralight tags are supported through the T=CL emulation. Just simply treat
the MIFARE tags as standard ISO 14443-4 tags. For more information, please refer to PICC
Commands (T=CL Emulation) for MIFARE 1K/4K Memory Cards.
Where:
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
In which,
Note: For ISO 14443-4 Type A tags, the ATS can be obtained by using the APDU “FF CA 01 00 00h”
Page 49 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Example: ISO 7816-4 APDU
To read 8 bytes from an ISO 14443-4 TypeA PICC.
APDU ={80 B2 80 00 08h}
Class = 80h
INS = B2h
P1 = 80h
P2 = 00h
Lc = None
Data In = None
Le = 08h
Page 50 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix C. Access MIFARE DESFire Tags (ISO
14443-4)
The MIFARE DESFire supports ISO 7816-4 APDU Wrapping and Native modes. Once the DESFire
Tag is activated, the first APDU sent to the DESFire Tag will determine the “Command Mode”. If the
first APDU is “Native Mode”, the rest of the APDUs must be in “Native Mode” format. Similarly, if the
first APDU is “ISO 7816-4 APDU Wrapping Mode”, the rest of the APDUs must be in “ISO 7816-4
APDU Wrapping Mode” format.
Example 2: MIFARE DESFire Frame Level Chaining (ISO 7816 wrapping mode)
In this example, the application has to do the “Frame Level Chaining”.
To get the version of the DESFire card:
Step 1: Send an APDU {90 60 00 00 00h} to get the first frame. INS=60h
Answer: 04 01 01 00 02 18 05 91 AFh [$91 AFh]
Step 2: Send an APDU {90 AF 00 00 00h} to get the second frame. INS=AFh
Answer: 04 01 01 00 06 18 05 91 AFh [$91 AFh]
Step 3: Send an APDU {90 AF 00 00 00h} to get the last frame. INS=AFh
Answer: 04 52 5A 19 B2 1B 80 8E 36 54 4D 40 26 04 91 00h [$91 00h]
To read 8 bytes random number from an ISO 14443-4 Type A PICC (DESFire)
APDU = {0A 00h}
Answer: AF 25 9C 65 0C 87 65 1D D7h [$1D D7h]
In which, the first byte “AFh” is the status code returned by the DESFire Card.
Page 51 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
The Data inside the blanket [$1D D7h] can simply be ignored by the application.
Note: In MIFARE DESFire Native Mode, the status code [90 00h] will not be added to the response if
the response length is greater than 1. If the response length is less than 2, the status code [90 00h]
will be added in order to meet the requirement of PC/SC. The minimum response length is 2.
Page 52 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix D. Access FeliCa Tags (ISO 18092)
Typical sequence may be:
Present the FeliCa Tag and Connect the PICC Interface.
Read/Update the memory of the tag.
In which,
F0 11 = FeliCa 212K
or
Note: The NFC ID can be obtained by using the APDU “FF CA 00 00 00h”. Please refer to the FeliCa
specification for more detailed information.
Page 53 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix E. NFC Forum Type 1 Tags (ISO 18092)
E.g. Jewel and Topaz Tags
In which,
F0 04 = Topaz
Step 2: Read the memory address 08 (Block 1: Byte-0) without using Pseudo APDU
<< 01 08
>> 18 [90 00]
In which, Response Data = 18
or
Step 2: Read the memory address 08 (Block 1: Byte-0) using Pseudo APDU
<< FF 00 00 00 [05] D4 40 01 01 08
In which,
[05] is the length of the Pseudo APDU Data “D4 40 01 01 08”
D4 40 01 is the DataExchange Command.
01 08 is the data to be sent to the tag.
Page 54 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Topaz Memory Map.
Note: Please refer to the Jewel and Topaz specification for more detailed information.
Page 55 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix F. Basic Program Flow for SAM
Applications
Step 0: Start the application. The reader will do the PICC Polling and scan for tags continuously.
Once the tag is found and detected, the corresponding ATR will be sent to the PC.
Step 1: Connect the ACR1222L SAM Interface N( N = 0, 1, 2 ) with T=0 or T=1protocol.
Step 2: Access the PICC by exchanging APDUs.
..
Page 56 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix G. Access ACOS3 SAM Cards (ISO 7816)
Step 1: Connect the Tag.
The ATR of the tag is 3B BE 18 00 00 41 01 38 00 00 01 00 12 34 56 78 01 90
00
In which,
TD1 = 00 and TD2 is absent ,So the SAM Card is a T=0 SAM Card
Page 57 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix H. ACR122U Compatible Commands
Appendix H.1. Direct Transmit via
PC_to_RDR_XfrBlock/PC_to_RDR_Escape
This command is used to send Pseudo APDU (Contactless Chip and Tag commands), and the
Response Data will be returned.
Command
Where:
Lc: 1 Byte. Number of Bytes to Send
Maximum 255 bytes
Data In: Contactless Chip or Tag Command
The data to be sent to the Contactless Chip and Tag
Response
Where:
Contactless Chip and Tag Response: Contactless Chip and Tag Response returned by the
reader.
SW1, SW2 = 90 00h means the operation is completed successfully
= 63 00h means the operation failed
= 63 27h means the checksum of the Response is wrong
Response
Page 58 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
E.g. Response = 41 43 52 31 32 32 32 4C 2D 55 20 56 33 31 33 2E 30 31h
= ACR1222L-U V313.01 (ASCII)
Response
Where:
PICC Operating Parameter. Default Value = FFh.
Page 59 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix H.4. Set the PICC Operating Parameter
This command is used to set the PICC Operating Parameter of the reader.
Command
Response
Where:
PICC Operating Parameter: Default Value = FFh
Page 60 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Appendix I. LCD Program example
Appendix I.1. LCD horizontal Scrolling
The scrolling function can be achieved by frequently update the display data on LCD. (The follow
displays are only used for illustrating the program concept, the results are not identical to the real LCD
display)
Example 1:
Assume the sample string “0123456789abcdef 01“is stored in the application program.
To achieve the right scrolling function, shift toward right by 1 character (8 pixels) in each update:
(Note: only ASCII mode characters can shift 8 pixels in scrolling)
1. Write the first data to the LCD using LCD Display (ASCII Mode)
Send escape command:
<< FF 00 68 00 10 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66
>> [90 00]
Page 61 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
3. To shift toward right by 8 pixels (one ASCII character size):
Send escape command:
<< FF 00 68 00 10 30 31 30 31 32 33 34 35 36 37 38 39 61 62 63 64
>> [90 00]
6. To complete one cycle, repeat the shifing process until shifting back to step 1.
To slow down the scrolling speed, add a >100ms delay between each escape command.
Page 62 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk
Example 2:
Assume the sample string “测试程式 识别“ is stored in the application program:
To achieve the left scrolling function, shift toward left by 1 GB character (16 pixels) in each update:
1. Write the first data to the LCD using LCD Display (GB Mode)
Send escape command:
<< FF 00 69 00 10 B2 E2 CA D4 B3 CC CA BD A1 A1 A1 A1 CA B6 B1 F0
>> [90 00]
4. To complete one cycle, repeat the shifing process until shifting back to step 1.
Page 63 of 63
www.acs.com
ACR1222L – Application Programming Interface [email protected]
.hk
Version 2.01 www.acs.com.hk