Peer to Peer communication between 2 PN532 not working

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Peer to Peer communication between 2 PN532 not working

4,629 Views
patrickvisser
Contributor I

I am trying to preform peer to peer communication between 2 PN532. 

I am able to read tags with the devices that I have.


I have tried multiple examples that say that they work but i am unable to get the 2 to detect each other.

When i look at the flowchart of the UM0701-02 (PN532 User Manual) paragraph  7.5.6 Peer to Peer example with two PN532 (active mode) 

The PN532 INITIATOR send a ack to the InJumpForDEP command, but does not give any response after that.

The PN532 Target send a ack to the TgInitAsTarget command , but does not give any response after that.\

The 2 PN532 are placed approximately 1 cm above each other.

the output and serial log of the INITIATOR:

P2P Initiator Demo BY ELECHOSUE!
-> 00 00 FF 02 FE D4 02 2A 00
<- 00 00 FF 00 FF 00
<- 00 00 FF 06 FA D5 03 32 01 06 07 E8
Found chip PN532
Firmware ver. 1.6
SAMConfiguration
-> 00 00 FF 05 FB D4 14 01 14 00 03 00
IRQ received
<- 00 00 FF 00 FF 00
<- 00 00 FF 02 FE D5 15 16
-> 00 00 FF 02 FE D4 04 28 00

<- 00 00 FF 00 FF 00
<- 00 00 FF 06 FA D5 05 00 00 00 80 A6
00 00 FF 06 FA D5 05 00 00 00 80 A6 00 00 00 00 00 00 00 00 00
InJumpForDEP

-> 00 00 FF 0A F6 D4 56 01 01 01 00 FF FF 00 00 D5 00
<- 00 00 FF 00 FF 00
InJumpForDEP sent ******

the output and serial log of the target:

P2P Target Demo From Elechouse!
-> 00 00 FF 02 FE D4 02 2A 00
<- 00 00 FF 00 FF 00
<- 00 00 FF 06 FA D5 03 32 01 06 07 E8
Found chip PN532
Firmware ver. 1.6
SAMConfiguration
-> 00 00 FF 05 FB D4 14 01 14 00 03 00
<- 00 00 FF 00 FF 00
<- 00 00 FF 02 FE D5 15 16

TgInitAsTarget
-> 00 00 FF 27 D9 D4 8C 00 04 00 12 34 56 40 01 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 00 00 25 00
<- 00 00 FF 00 FF 00
Target init sent.

After this the devices do not send any more over the serial link.

Can you give me any idea what is going wrong?

Tags (1)
0 Kudos
5 Replies

1,949 Views
Bamsinel
Contributor I

Hi,

I know it is a 5 years old later reply, but a few weeks back I had the same issue connecting two PN532 as Initiator and Target.

After 5-6 days of debugging, I see that the target is not replying to the initiator unless the Mode (the first byte which is currently 0x00 in OP's log message) is set to "DEP only" (that is 0x2).

0 Kudos

1,306 Views
mahdinxp
Contributor I

Hey,

I've worked on it since 4 days ago but they still can't find each other. Could you please share your code with me?

0 Kudos

2,958 Views
patrickvisser
Contributor I

Hallo Jorge,

We send the SAMConfiguration to disable the IRQ pin because we do no have it connected a  the moment, we have demo board directly connected to a USB to serial converter.

We found that there was no problem with the code. To investigate the problem we ordered some adafruit boards and with these boards the code worked directly.  

After more investigation we found that the antenna was not tuned correctly on the boards.
(these boards where given to me by my costumer) 

The weird thing was that the board could read tags and communicate with a android phone.

0 Kudos

2,958 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

HI Patrick,

Good to know you got it working with the different boards.

In Peer to Peer active mode each device generates its own field, then a defective antenna tuning can make the communication fail. When reading tags there is only one RF Field generated by the reader and the target only "loads" that field with data, so it makes sense that it might receive the responses from the tag even with the incorrect tuning.

Regards!

Jorge Gonzalez

0 Kudos

2,958 Views
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Patrick Visser,

In your serial log there is nothing obvious which points to the issue. However the SAMConfiguration command is strange, why are you sending that one? By default the PN532 is configured to not use any SAM. Also with the same command you disable the IRQ pin, is that on purpose?

Since you are correctly following the P2P flowchart then this must be either a hardware issue or a host link issue.

Please notice that after sending the TgInitAsTarget command the PN532 goes to power down, so in your system (Host + PN532) you must correctly handle the handshake mechanism depending on the host interface (I2C, SPI or UART). This is why disabling the IRQ functionality could cause problems. The handshake mechanisms are explained in Chapter 6.3 of the User Manual.

A good idea is to monitor the serial buses with a scope. It is possible that both PN532 are actually detecting each other but there is no notification to the host(s).

Best Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos