# Hello everyone, I have a problem. I want to make a peer-to-peer communication between two Arduinos using PN532. I'm using this NDEF code, but not work

**URL:** <https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598>\
**Category:** Programming\
**Created:** [May 19, 2025, 7:45am UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598 "2025-05-19T07:45:44Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 7:45am UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/1 "2025-05-19T07:45:44Z")

</div>

// Receive a NDEF message from a Peer  
// Requires SPI. Tested with Seeed Studio NFC Shield v2

#include "SPI.h"  
#include "PN532\_SPI.h"  
#include "snep.h"  
#include "NdefMessage.h"

PN532\_SPI pn532spi(SPI, 10);  
SNEP nfc(pn532spi);  
uint8\_t ndefBuf[128];

void setup() {  
Serial.begin(9600);  
Serial.println("NFC Peer to Peer Example - Receive Message");  
}

void loop() {  
Serial.println("Waiting for message from Peer");  
int msgSize = nfc.read(ndefBuf, sizeof(ndefBuf));  
if (msgSize \> 0) {  
NdefMessage msg = NdefMessage(ndefBuf, msgSize);  
msg.print();  
Serial.println("\nSuccess");  
} else {  
Serial.println("Failed");  
}  
delay(3000);  
}

 ![174841c6ae384298a5334224f84dde58e355cdb9_2_1332x1000](https://europe1.discourse-cdn.com/arduino/original/4X/9/0/a/90acfee7b51733a866955f501bb21d15e95e0449.jpeg)

```arduino
saisissez ou collez du code ici

```

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [May 19, 2025, 7:51am UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/2 "2025-05-19T07:51:06Z")

</div>

Welcome to the forum

As your topic does not relate the the Arduino project itself it has been moved to the Programming category of the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'  
  
Use **code tags** (the \< CODE/ \> icon above the compose window)&nbsp;to make it easier to read and copy for examination   
  
[https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum)

Please post your full sketch, using code tags when you do

Posting your code using code tags prevents parts of it being interpreted as HTML coding and makes it easier to copy for examination

In my experience the easiest way to tidy up the code and add the code tags is as follows

Start by tidying up your code by using Tools/Auto Format in the IDE to make it easier to read. Then use Edit/Copy for Forum and paste what was copied in a new reply. Code tags will have been added to the code to make it easy to read in the forum thus making it easier to provide help.

It is also helpful to post error messages in code tags as it makes it easier to scroll through them and copy them for examination

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [May 19, 2025, 1:12pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/3 "2025-05-19T13:12:42Z")

</div>

Did you have a question?

---

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 1:51pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/4 "2025-05-19T13:51:15Z")

</div>

Yes how do peer to peer communication of 2arduino with 2 pn532

---

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 1:57pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/5 "2025-05-19T13:57:00Z")

</div>

> [@imadlw](#):
>
> // Receive a NDEF message from a Peer  
> // Requires SPI. Tested with Seeed Studio NFC Shield v2
> 
> #include "SPI.h"  
> #include "PN532\_SPI.h"  
> #include "snep.h"  
> #include "NdefMessage.h"
> 
> PN532\_SPI pn532spi(SPI, 10);  
> SNEP nfc(pn532spi);  
> uint8\_t ndefBuf[128];
> 
> void setup() {  
> Serial.begin(9600);  
> Serial.println("NFC Peer to Peer Example - Receive Message");  
> }
> 
> void loop() {  
> Serial.println("Waiting for message from Peer");  
> int msgSize = nfc.read(ndefBuf, sizeof(ndefBuf));  
> if (msgSize \> 0) {  
> NdefMessage msg = NdefMessage(ndefBuf, msgSize);  
> msg.print();  
> Serial.println("\nSuccess");  
> } else {  
> Serial.println("Failed");  
> }  
> delay(3000);  
> }

Communicate 2 PN532 with each other using SPI protocol

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [May 19, 2025, 2:03pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/6 "2025-05-19T14:03:30Z")

</div>

Using Tools / Auto Format makes the code readable. Posting in code tags makes code easily copyable, so we can test.  
Perhaps you did not read the pinned post re 'How to get the most from the forum'  
Since there are several ways for two Arduinos to communicate and I am sure you googled that, maybe save us some time and tell us what you ruled out and why.

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [May 19, 2025, 2:05pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/7 "2025-05-19T14:05:01Z")

</div>

WAIT, didn't you just answer yourself in the following (#5) post????

---

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 2:05pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/8 "2025-05-19T14:05:38Z")

</div>

> [@sonofcy](#):
>
> WAIT, didn't you just answer yourself in the followin[quote="sonofcy, post:7, topic:1382598, full:true"]  
> WAIT, didn't you just answer yourself in the following (#5) post????

Non this code not work showing faild faild faild

---

<div class="post-metadata">

**Author:** ![sonofcy](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/sonofcy/32/1283617_2.png) [@sonofcy](https://forum.arduino.cc/u/sonofcy)\
**Post date:** [May 19, 2025, 2:06pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/9 "2025-05-19T14:06:12Z")

</div>

BTW, that is my last choice for a wired solution.

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [May 19, 2025, 2:06pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/10 "2025-05-19T14:06:43Z")

</div>

> [@imadlw](#):
>
> Yes how do peer to peer communication of 2arduino with 2 pn532

iI do it with several Nano's, I simply use CAN and Cory's Fowlers mcp-can library, it works great. Currently I have 9 nodes.

---

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 2:08pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/11 "2025-05-19T14:08:09Z")

</div>

I want to use SPI because i want speed Reading

---

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 2:10pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/12 "2025-05-19T14:10:36Z")

</div>

> [@gilshultz](#):
>
> > [@imadlw](#):
> >
> > Yes how do peer to peer communication of 2arduino with 2 pn532
> 
> iI do it with several Nano's, I simply use CAN and Cory's Fowlers mcp-can library, it works great. Currently I have 9 nodes.

I want wireless communication not wireled ,so SPI give me speed and its wireless

---

<div class="post-metadata">

**Author:** ![camsysca](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/camsysca/32/1015228_2.png) [@camsysca](https://forum.arduino.cc/u/camsysca)\
**Post date:** [May 19, 2025, 2:11pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/13 "2025-05-19T14:11:18Z")

</div>

11 posts, you're still giving info in bits and pieces, and no code tags yet. Have fun.

---

<div class="post-metadata">

**Author:** ![imadlw](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/imadlw/32/1217946_2.png) [@imadlw](https://forum.arduino.cc/u/imadlw)\
**Post date:** [May 19, 2025, 2:16pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/14 "2025-05-19T14:16:48Z")

</div>

I have two arduino and two module pn532 i want to one been reciver and one been sender \>\>\>communication in one direction no problem ,must important a message send by pn532 and reciver by other

---

<div class="post-metadata">

**Author:** ![gilshultz](https://avatars.discourse-cdn.com/v4/letter/g/67e7ee/32.png) [@gilshultz](https://forum.arduino.cc/u/gilshultz)\
**Post date:** [May 20, 2025, 12:27am UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/15 "2025-05-20T00:27:02Z")

</div>

> [@imadlw](#):
>
> SPI give me speed and its wireless

Hint: Both use SPI, pn532 max 424 kbit/s CAN 1 Mbps, reliability of communications ???

> **[Success! PN532 is not easy to work with!](https://forum.dangerousthings.com/t/success-pn532-is-not-easy-to-work-with/1108)**
>
> A few months ago I made an RFID based punchclock for the company based on 125kz RFID. Then my interest in implants grew. I purchased the xEM specifically so I could use it with the punchclock… But after some thought (and before implanting...

> **[PN532\_Manual\_V3.pdf](https://dangerousthings.com/wp-content/uploads/PN532_Manual_V3.pdf)**
>
> 1686.39 KB

---

<div class="post-metadata">

**Author:** ![UKHeliBob](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/ukhelibob/32/215663_2.png) [@UKHeliBob](https://forum.arduino.cc/u/UKHeliBob)\
**Post date:** [May 22, 2025, 1:09pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/16 "2025-05-22T13:09:54Z")

</div>

Your other topic on the same subject deleted.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

> [@How to get the best out of this forum](https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum/679966):
>
> See also [FAQ - Arduino Forum](https://forum.arduino.cc/faq) for general rules on forum behavior and etiquette. Hello, Welcome to the Arduino Forum. This guide explains how to get the best out of this forum. Please read and follow the instructions below. Being new here you might think this is having rules for the sake of rules, but that is not the case. If you don’t follow the guidelines all that happens is there is a long exchange of posts while we try to get you to tell us what we need in order to help you, which is frus…

It will help you get the best out of the forum in the future.

Thank you.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [November 18, 2025, 1:10pm UTC](https://forum.arduino.cc/t/hello-everyone-i-have-a-problem-i-want-to-make-a-peer-to-peer-communication-between-two-arduinos-using-pn532-im-using-this-ndef-code-but-not-work/1382598/17 "2025-11-18T13:10:04Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
