Topic: nfc shield v 2.0 TgInitAsTarget response problem

Hello! I try to emulate mifare classic using nfc shield v 2.0 + Arduino UNO

Nfc shield include PN 532. Data transfer  is realized on SPI. When I try to send command TgInitAsTarget I don't receive nothing answers from PN532:-(  I used some code from libnfc.  Can you help me?

Logs:

Start Arduino UNO R3
>> 0 FF 4 FC D4 6 63 3D 86 0
<< 0 FF 3 FD D5 7 0 24 0 0
>> 0 FF 5 FB D4 8 63 3D 0 84 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 2 C1 0
<< 0 FF 3 FD D5 7 80 A4 0 0
>> 0 FF 5 FB D4 8 63 2 80 3F 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 3 C0 0
<< 0 FF 3 FD D5 7 80 A4 0 0
>> 0 FF 5 FB D4 8 63 3 80 3E 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 D B6 0
<< 0 FF 3 FD D5 7 0 24 0 0
>> 0 FF 5 FB D4 8 63 D 0 B4 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 38 8B 0
<< 0 FF 3 FD D5 7 5 1F 0 0
>> 0 FF 5 FB D4 8 63 38 5 84 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 3 FD D4 12 14 6 0
<< 0 FF 2 FE D5 13 18 0 0
>> 0 FF 4 FC D4 6 63 3 C0 0
<< 0 FF 3 FD D5 7 80 A4 0 0
>> 0 FF 5 FB D4 8 63 3 80 3E 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 3 C0 0
<< 0 FF 3 FD D5 7 80 A4 0 0
>> 0 FF 5 FB D4 8 63 3 80 3E 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 2 FE D4 2 2A 0
<< 0 FF 6 FA D5 3 32 1 6 7 E8 0 0
PN532 v1.6 (0x7)
>> 0 FF 4 FC D4 6 63 2 C1 0
<< 0 FF 3 FD D5 7 80 A4 0 0
>> 0 FF 5 FB D4 8 63 2 80 3F 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 3 C0 0
<< 0 FF 3 FD D5 7 80 A4 0 0
>> 0 FF 5 FB D4 8 63 3 80 3E 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 4 FC D4 6 63 D B6 0
<< 0 FF 3 FD D5 7 0 24 0 0
>> 0 FF 5 FB D4 8 63 D 0 B4 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 3 FD D4 12 20 FA 0
<< 0 FF 2 FE D5 13 18 0 0
>> 0 FF 4 FC D4 6 63 5 BE 0
<< 0 FF 3 FD D5 7 20 4 0 0
>> 0 FF 5 FB D4 8 63 5 24 98 0
<< 0 FF 2 FE D5 9 22 0 0
>> 0 FF 27 D9 D4 8C 5 8 0 12 34 56 40 1 FE A2 A3 A4 A5 A6 A7 C0 C1 C2 C3 C4 C5 C6 C7 FF FF AA 99 88 77 66 55 44 33 22 11 0 0 1C 0
nothing response

Re: nfc shield v 2.0 TgInitAsTarget response problem

Try to compare your trace against one from libnfc (use LIBNFC_LOG_LEVEL=3 to see the raw frames)
There might be some differences in the initialization of the chip.
Right now I don't have a reader with me so I cannot do it myself.

Other tips:
TgInitAsTarget sends its result only once a target has been acquired or after timeout if you did configure a timeout.
Try at lower SPI speed. The last frame is much longer and maybe more sensible to timing.
And obviously you implemented the SPI handshake properly, did you?

Good luck
Phil

3 (edited by alexeybar2008 2013-11-06 18:24:38)

Re: nfc shield v 2.0 TgInitAsTarget response problem

I have tried lower SPI speed but also got no response from pn 532. I used some code from libnfc 1.3.9 with changes of version 1.7. Unfortunately I can not make full use of spi, because IRQ pin pn532 not used in nfc shield. If I use a delay of 5/15/50ms after sending the command is also not getting a response of pn532.

Example  “PtoPTarge”  (Adafruits PN532 Library) does not work  also.(Other examples are working normally)