adafruit / Adafruit-PN532

Arduino library for SPI and I2C access to the PN532 RFID/Near Field Communication chip
Other
421 stars 265 forks source link

SPI Wiring Not working on d1 mini #92

Closed 6000850 closed 1 year ago

6000850 commented 3 years ago

Hello This wiring is SPI, but after uploading the ReadTag.ino code, the message "Didn't find PN53x board" is displayed.

My Board : Wemos D1 Mini

My Wiring :

SCK => D5
MISO => D6
MOSI => D7
SS => D3
VCC => 3.3V
GND => GND

When I connect the SS pin to D8. Upload gives an error and the code is not uploaded

ReadTag.ino

#include <NfcAdapter.h>
#include <PN532/PN532/PN532.h>

    #include <SPI.h>
    #include <PN532/PN532_SPI/PN532_SPI.h>
    PN532_SPI pn532spi(SPI, 0);
    NfcAdapter nfc = NfcAdapter(pn532spi);

void setup(void) {
    SERIAL.begin(9600);
    SERIAL.println("NDEF Reader");
    nfc.begin();
}

void loop(void) {
    SERIAL.println("\nScan a NFC tag\n");
    if (nfc.tagPresent()) {
        NfcTag tag = nfc.read();
        tag.print();
    }
    delay(5000);
}
6000850 commented 3 years ago

SoftwareSerial worked! but SPI NOT Working!! why!?

caternuson commented 1 year ago

Closing. Looks like a different library is being used. There is no PN532_SPI class in this library.

    PN532_SPI pn532spi(SPI, 0);