Download Print this page
ACS ACR122 Series Application Programming Interface

ACS ACR122 Series Application Programming Interface

Nfc contactless smart card reader
Hide thumbs Also See for ACR122 Series:

Advertisement

Application Programming Interface
ACR122 NFC Contactless Smart Card Reader
Advanced Card Systems Ltd.
Website: www.acs.com.hk
Email: info@acs.com.hk

Advertisement

loading
Need help?

Need help?

Do you have a question about the ACR122 Series and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Summary of Contents for ACS ACR122 Series

  • Page 1 Application Programming Interface ACR122 NFC Contactless Smart Card Reader Advanced Card Systems Ltd. Website: www.acs.com.hk Email: info@acs.com.hk...
  • Page 2: Table Of Contents

    ACR122 NFC Contactless Smart Card Reader CONTENTS Introduction Features USB interface Contact and Contactless interface handling Pseudo APDUs Basic program flow Card access Appendix ACR122U Application Programming iInterface Page 2 of 27 Version 1. 0 January 2008...
  • Page 3: Introduction

    ACR122 NFC Contactless Smart Card Reader Introduction The ACR122U is a PC-linked Contactless Cards reader and writer for accessing MIFARE, ISO14443-4 Type A&B, FeliCa and NFC Tags. Features • USB PnP, 12Mbps • PCSC Interface (API level only) • CCID Standard •...
  • Page 4: Contact And Contactless Interface Handling

    ACR122 NFC Contactless Smart Card Reader Contact and Contactless Interfaces Handling The contactless interface is operating on the top of contact interface. Some Pseudo APDUs are defined for contactless interface. If the reader finds that the APDUs are for contactless interface, the APDUs will be routed to the contactless interface, otherwise, the APDUs will be routed to contact interface.
  • Page 5: Pseudo Apdus

    ACR122 NFC Contactless Smart Card Reader Pseudo APDUs PSCS interface is used for exchanging APDUs and Responses between the PC and Tag. The ACR122U will handle the required protocol internally. ACR122U comes with two primitive commands for this purpose. Direct Transmit To send an APDU (PN532 and Contactless Commands), and the length of the Response Data will be returned.
  • Page 6 ACR122 NFC Contactless Smart Card Reader Checksum The checksum of the Contactless Error Response is wrong. Parameter The PN532_Contactless Command is Error wrong. Get Response To retrieve the response data after the “Direct Command” is issued. Table 2.0A: Get Response Command Format (5 Bytes) Command Class Get Response...
  • Page 7 ACR122 NFC Contactless Smart Card Reader P2: LED State Control Table 3.0B: Bi-Color LED and Buzzer Control Format (1 Byte) Item Description Bit 0 Final Red LED State 1 = On; 0 = Off Bit 1 Final Green LED State 1 = On;...
  • Page 8 ACR122 NFC Contactless Smart Card Reader Remark: The LED State operation will be performed after the LED Blinking operation is completed. The LED will not be changed if the corresponding LED Mask is not enabled. The LED will not be blinking if the corresponding LED Blinking Mask is not enabled. Also, the number of repetition must be greater than zero.
  • Page 9: Basic Program Flow

    ACR122 NFC Contactless Smart Card Reader Basic Program Flow for Contactless Applications Step 0. Start the application. The first thing is to connect the “ACR122U PCSC Interface”. The ATR of the SAM (if a SAM is inserted) or a Pseudo-ATR “3B 00” (if no SAM is inserted) will be returned.
  • Page 10 ACR122 NFC Contactless Smart Card Reader 3) The antenna can be switched off in order to save the power. • Turn off the antenna power: FF 00 00 00 04 D4 32 01 00 • Turn on the antenna power: FF 00 00 00 04 D4 32 01 01 4) No Automatic Contactless Tag Insertion or Removal Event will be generated.
  • Page 11 ACR122 NFC Contactless Smart Card Reader 6) For the contactless interface: Because of the limitation of ISO7816 T=0 protocol (Standard Microsoft CCID drivers), it is not possible to send both “Lc” and “Le” in a single APDU. Therefore, we have to split the APDU into two separate APDUs. Firstly, we send the APDU “Direct Transmit”...
  • Page 12: Card Access

    ACR122 NFC Contactless Smart Card Reader Card Access How to access MIFARE Classic Tags? Typical sequence may be: Scanning the tags in the field (Polling) Authentication Read / Write the memory of the tag Halt the tag (optional) Step 1) Polling for the MIFARE 1K/4K Tags, 106 kbps <<...
  • Page 13 ACR122 NFC Contactless Smart Card Reader In which, Block Data = 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 Step 4) Update the content of Block << FF 00 00 00 15 D4 40 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 >>...
  • Page 14 ACR122 NFC Contactless Smart Card Reader How to handle Value Blocks of MIFARE 1K/4K Tag? The value blocks are used for performing electronic purse functions. E.g. Increment, Decrement, Restore and Transfer .. etc. The value blocks have a fixed data format which permits error detection and correction and a backup management.
  • Page 15 ACR122 NFC Contactless Smart Card Reader Step 5) Copy the value of Block to Block (dec) << FF 00 00 00 05 D4 40 >> 61 05 << FF C0 00 00 05 >> D5 41 [00] 90 00 << FF 00 00 00 05 D4 40 >>...
  • Page 16 ACR122 NFC Contactless Smart Card Reader How to access MIFARE Ultralight Tags? Typical sequence may be: Scanning the tags in the field (Polling) Read / Write the memory of the tag Halt the tag (optional) Step 1) Polling for the MIFARE Ultralight Tags, 106 kbps <<...
  • Page 17 ACR122 NFC Contactless Smart Card Reader How to access ISO14443-4 Type A and B tags? Typical sequence may be: Scanning the tags in the field (Polling) with the correct parameter (Type A or B) Change the Baud Rate (optional for Type A tags only) Perform any T=CL command Deselect the tag Step 1) Polling for the ISO14443-4 Type A Tag, 106 kbps...
  • Page 18 ACR122 NFC Contactless Smart Card Reader How to access FeliCa Tags? Typical sequence may be: Scanning the tags in the field (Polling) Read / Update the memory of the tag Deselect the tag Step 1) Polling for the FeliCa Tag, 212 kbps, Payload = 00 FF FF 00 00 <<...
  • Page 19 ACR122 NFC Contactless Smart Card Reader How to access NFC Forum Type 1 Tags? E.g. Jewel and Topaz Tags Typical sequence may be: Scanning the tags in the field (Polling) Read / Update the memory of the tag Deselect the tag Step 1) Polling for the Jewel or Topaz Tag, 106 kbps <<...
  • Page 20 ACR122 NFC Contactless Smart Card Reader Get the current setting of the contactless interface Step 1) Get Status Command << FF 00 00 00 02 D4 04 >> 61 0C << FF C0 00 00 0C >> D5 05 [Err] [Field] [NbTg] [Tg] [BrRx] [BrTx] [Type] 80 90 00 Or if no tag is in the field >>...
  • Page 21 ACR122 NFC Contactless Smart Card Reader Appendix 1: Error Codes Table Error Cause Error Code No Error 0x00 Time Out, the target has not answered 0x01 A CRC error has been detected by the contactless UART 0x02 A Parity error has been detected by the contactless UART 0x03 During a MIFARE anticollision/select operation, an erroneous Bit Count has been 0x04...
  • Page 22: Appendix

    ACR122 NFC Contactless Smart Card Reader Appendix 2: Sample Codes for accessing FeliCa Tags Example 1: To initialize a FeliCa Tag (Tag Polling) Step 1: Issue a “Direct Transmit” APDU. ” The APDU Command should be “FF 00 00 00 09 D4 4A 01 01 00 FF FF 01 00 #In which, Direct Transmit APDU = “FF 00 00 00”...
  • Page 23 ACR122 NFC Contactless Smart Card Reader Example 3: To read 16 bytes data from the FeliCa Tag (Tag Write) Step 1: Issue a “Direct Transmit” APDU. The APDU Command should be “FF 00 00 00 13 D4 40 01 10 06 01 01 05 01 86 04 02 02 01 09 01 01 80 ”...
  • Page 24 ACR122 NFC Contactless Smart Card Reader Appendix 3: Sample Codes for Setting the LED Example 1: To read the existing LED State. // Assume both Red and Green LEDs are OFF initially // // Not link to the buzzer // APDU = “FF 00 40 00 04 00 00 00 00”...
  • Page 25 ACR122 NFC Contactless Smart Card Reader Example 4: To turn on the Red LED for 2 sec. After that, resume to the initial state // Assume the Red LED is initially OFF, while the Green LED is initially ON. // // The Red LED and buzzer will turn on during the T1 duration, while the Green LED will turn off during the T1 duration.
  • Page 26 ACR122 NFC Contactless Smart Card Reader 1Hz = 1000ms Time Interval = 500ms ON + 500 ms OFF T1 Duration = 500ms = 0x05 T2 Duration = 500ms = 0x05 Number of repetition = 0x03 Link to Buzzer = 0x01 APDU = “FF 00 40 50 04 05 05 03 01”...
  • Page 27 ACR122 NFC Contactless Smart Card Reader Example 7: To blink the Red and Green LED in turn of 1Hz for 3 times // Assume both Red and Green LEDs are initially OFF. // // The Initial Red Blinking State is ON; The Initial Green Blinking States is OFF // // The buzzer will turn on during the T1 duration// Red LED On Red LED Off...

This manual is also suitable for:

Acr122u