Comunicating with NFC using ESP8266

Hi

I used don/NDEF library (GitHub) to connect my Adafruit PN532 (NFC module) with Arduino. The idea is making peer to peer connection with an android phone using NFC.

Now, I am interested to change the arduino with an ESP8266 board. The code I am woking on is available here as well as this link:

// Sends a NDEF Message to 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 - Send Message");
}

void loop() {
    Serial.println("Send a message to Peer");
    
    NdefMessage message = NdefMessage();
    message.addUriRecord("http://shop.oreilly.com/product/mobile/0636920021193.do");
    //message.addUriRecord("http://arduino.cc");
    //message.addUriRecord("https://github.com/don/NDEF");

    
    int messageSize = message.getEncodedSize();
    if (messageSize > sizeof(ndefBuf)) {
        Serial.println("ndefBuf is too small");
        while (1) {
        }
    }

    message.encode(ndefBuf);
    if (0 >= nfc.write(ndefBuf, messageSize)) {
        Serial.println("Failed");
    } else {
        Serial.println("Success");
    }

    delay(3000);
}

Now, my question is that if I change the wires from the arduino to ESP8266 board (Specifically, NODEMCU with ESP 8266, 12E) should it work? Or should I change something in the libraries for it?

As much as I tried, I could not make it work.

I found the problem myself, so here it is (I posted this in github/DON/NDEF issues section as well):

I am a beginner with ESP8266, this is why I asked this question and here is the answer. I found it possible. Just the pin outs should be adjusted correctly. For SPI connection, the pins should be defined like this:

On nodeMCU, the pin D5-D6-D7-D8 are for SPI connection.

D5 is HSCLK which is similar to SCK in arduino UNO (Pin 13)
D6 is HMISO which is similar to MISO in arduino UNO (Pin 12)
D7 is HMOSI which is similar to MOSI in arduino UNO (Pin 11)
VERY IMPORTANT:
**D8 is HCS which is similar to SS in arduino UNO (Pin 10) , However, when you define the pinout in the codes in arduinoIDE, the slave pin should be defined as
PN532_SPI pn532spi(SPI, 15); **

The nodeMCU pin-outs can be found a lot on internet:

zeedo65,

Did you manage to get this working on ESP8266?

Also, did you manage to send NDEF messages larger than 244 bytes?

Thank you!