0

I recently purchased the ACR122U from here. I am attempting to place it into Card Emulation mode to have it communicate with a system running a PN7150 in Initiator Mode.

I've managed to communicate with the device's PN532 IC (user manual); sending basic commands, e.g. getting the status, FW version, etc...

I am unable to place it in card emulation mode though. Below is the super simple python script I'm using to attempt to do this:

from smartcard.System import *
from smartcard import util

'''
Command Application Protocol Data Units

C-APDU Structure:
    [ Class + Instruction + Param_1 + Param_2 + Data Length + Data ]
'''

# ACS Direct Transmit Header - [ Class + Instruction + Param_1 + Param_2 ] #
ACS_DIRECT_TRANSMIT = [ 0xFF, 0x00, 0x00, 0x00 ]

# PN532 COMMANDS - [ Data Length + Data ] #
PN532_CMDS = {
                'GET_READER_FW_VERSION' : [ 0x02, 0xD4, 0x02 ],
                'GET_READER_STATUS'     : [ 0x02, 0xD4, 0x04 ],

                # Enable ISO/IEC 14443-4 PICC emulation & automatic RATS #
                'SET_PARAMETERS'        : [ 0x03, 0xD4, 0x12, 0x30 ],
                'CONFIGURE_CE_MODE'     : [
                                            0x27,             # Data Length
                                            0xD4, 0x8C,       # Command header
                                            0x05,             # Mode - PICC/Passive
                                            0x04, 0x00,       # ATQA
                                            0x12, 0x34, 0x56, # UID: Last 3 bytes
                                            0x20,             # SAK

                                            # =====[ Unused ] ===== #
                                            # FeliCa Params #
                                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                            0x00, 0x00,

                                            # ATR Bytes #
                                            0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                            # ===== [ Unused ] ===== #

                                            0x00, # General Bytes Length.
                                            0x00  # Historical Bytes Length.
                                          ]
             }

def printResponseApdu(data, sw1, sw2):
    data = util.toHexString(data)
    status = util.toHexString([sw1, sw2])
    print(f"R-APDU << Data:{data} Status:{status}")

def main():
    scReaders = readers()
    print("Available readers:", scReaders)

    reader = scReaders[0]
    print("Using:", reader)
    connection = reader.createConnection()

    connection.connect()
    print("Connection Established!")

    respData, sw1, sw2 = connection.transmit(ACS_DIRECT_TRANSMIT + PN532_CMDS['CONFIGURE_CE_MODE'])
    printResponseApdu(respData, sw1, sw2)

if __name__ == "__main__":
    main()

This results in the error:

 ...
        sw1 = (response[-2] + 256) % 256
    IndexError: list index out of range

I'm assuming this means that no response was received and I don't think it's a driver issue because other commands work just fine.

Any insight will be greatly appreciated.

Anviori
  • 15
  • 8
  • Hmm if you look at the ACR122 technical spec v3.06 direct from ACS's web pages https://www.acs.com.hk/download-manual/418/TSP-ACR122U-3.06.pdf all reference to Card Emulation has been removed compared to older v3.00 version referenced from the vendor's web site https://www.scbsolutions.com/express/redirectt.php?action=url&goto=www.scbsolutions.com%2FBrochures%2FACR122U.pdf May be the functionality was never there or has been removed as there is no reference to Card Emulation in the API Doc compared to the acr1252u which has details in it's API for Card Emulation, Fishy? – Andrew Apr 30 '20 at 00:30
  • Interesting... the internal transceiver (PN532) in the ACR122U supports card emulation though. I've seen other examples online of this being possible (e.g. this question: https://stackoverflow.com/questions/14854933/how-to-card-emulate-with-acr122u-a9?rq=1) i just can't seem to make it work – Anviori Apr 30 '20 at 00:58
  • Another example: https://github.com/AdamLaurie/RFIDIOt – Anviori Apr 30 '20 at 01:15
  • This might not be your problem but have you taken apart your actual reader to check the chip, have ACS replaced the chip in the later models with a clone/alternative that does not support card emulation or may be have they just disabled that feature somehow to make it a feature differentiator to the ACR1252U? It may be worth asking ACS tech support why v3 of the has card emulation support and v3.06 does not. – Andrew Apr 30 '20 at 08:53
  • I opened it up and googling "5321 06" (The top most number on the IC) leads me to NXP's PN532, which is the correct chip. I've contacted them about this. I will post their response here when I receive one. It's possible they're suppressing it through their driver software; but that's speculation... – Anviori Apr 30 '20 at 13:46

0 Answers0