How to solve tgInitAsTarget response problem with ACR122U-A9?
Asked Answered
D

0

1

I am working over emulating ndef tags with acr122U device(PN532 chip). My start point was the question at How to card emulate with ACR122U-A9. I can manage device (I can change led or buzzer states) with direct commands. But could not get a response from device when I pass tgInitAsTarget command. There is no an error, I am getting empty response when I pass tgInitAsTarget.

I am working over an windows 10 machine with Java, the acr122u firmware is ACR122U215 version.

Here is my commands and responses:

Read registers
<< FF 00 00 00 08 D4 06 63 05 63 0D 63 38 
>> D5 07 07 00 05 90 00 

Write registers
<< FF 00 00 00 11 D4 08 63 02 80 63 03 80 63 05 07 63 0D 00 63 38 05 
>> D5 09 90 00 

Set parameters
<< FF 00 00 00 03 D4 12 30 
>> D5 13 90 00 

tgInitAsTargetCommand
<< FF 00 00 00 27 D4 8C 05 04 00 12 34 56 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
>>      

There should be a response, but I could not get response, and I wonder what is wrong?

tgInitAsTargetCommand
<< FF 00 00 00 27 D4 8C 05 04 00 12 34 56 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
>>          //??Why could not I get response?         
Depalma answered 4/5, 2019 at 20:26 Comment(9)
Got the same issue. Have you managed to solve it?Bumgardner
Maybe an insight for this issue. Referring to Michael's comment here: #21051815 the tgInitAsTargetCommand is a blocking command and will return empty response until a reader apporach to the emulated tag.Bumgardner
Yes I have read about the tgInitAsTargetCommand is a blocking command, but I do not know how to get callback from pn532 when a reader connected. It necessary getting that callback before sending tgGetData and tgSetData commands. If I send tgGetData and tgSetData after tgInitAsTargetCommand ,I am getting D5 87 25 90 00 . Which 25 is not the expected response code.Depalma
Sayer I have seemed to have solved this issue now. Whenever I am not getting response from tgInitAsTargetCommand, I will resend the same command. I will eventually get a response. Same thing with TG_GET_DATA too. If this works for you, I will write up the answer.Bumgardner
Kong Chun Ho, I tried your suggestion but unfortunately it did not worked on me. I am using javax.smartcardio.Card to connect to the reader, and transmitControlCommand always returns empty bytes. Even if I send it again and again . But using nfctools app I can see that the reader is starting emulating tag, but because of I could not communicate with device by sending 'tgGetData' and 'tgSetData' commands, i could not emulate content of a tag. So I could not understand what is the problem?Depalma
I looped the (same) tgInitAsTarget command until I get a non-empty response. Then, I can supply tgGet/SetData APDU.Bumgardner
The tgInitAsTarget will return nothing until a reader is approached to the emulated tag, then the tgInitAsTarget APDU will return a valid, non-empty response.Bumgardner
I have put the reader(an android phone) on acr122u before I have sent 'tgInitAsTarget' command. And looped until getting a response from that command. but it did not gave response, all responses are empty. here is the code, it is looping forever even if I put reader on it : codeshare.io/5gE8e8Depalma
@Depalma I'm getting the same [ 87 25 ] response to TgGetData commands. According to the PN532 User Guide the 25 is an error code meaning "DEP Protocol: Invalid device state, the system is in a state which does not allow the operation". In my case I'm pretty sure that's because I (successfully) TgInitAsTarget'ed my emulator in passive mode only (mode byte = 0x01), no DEP. You are passing 0x05 for your mode, which if I read the doc correctly is both passive and PICC, but no DEP. Perhaps we both need to reconsider the mode we are using.Mandy

© 2022 - 2024 — McMap. All rights reserved.