Page 1 of 1

TTGO-T-display + pn532

Posted: Tue Mar 09, 2021 5:47 pm
by chiffa
hello. i try to connect pn532 nfc module to esp32 TTGO-T-display over spi, like this:

Image

I try to use code:

Code: Select all

#include <Wire.h>
#include <SPI.h>
#include <Adafruit_PN532.h>

#define PN532_SCK  (2)
#define PN532_MISO (15)
#define PN532_MOSI (13)
#define PN532_SS   (37)

Adafruit_PN532 nfc(PN532_SCK, PN532_MISO, PN532_MOSI, PN532_SS);


void setup(void) {

  Serial.begin(115200);

  nfc.begin();

  uint32_t versiondata = nfc.getFirmwareVersion();
  if (! versiondata) {
    Serial.print("Didn't find PN53x board");
    while (1); // halt
  }
  // Got ok data, print it out!
  Serial.print("Found chip PN5"); Serial.println((versiondata>>24) & 0xFF, HEX); 
  Serial.print("Firmware ver. "); Serial.print((versiondata>>16) & 0xFF, DEC); 
  Serial.print('.'); Serial.println((versiondata>>8) & 0xFF, DEC);
  
  // configure board to read RFID tags
  nfc.SAMConfig();

}

Then i fix bitrade to 100000 in file Adafruit_PN532.cpp:

Code: Select all

Adafruit_PN532::Adafruit_PN532(uint8_t clk, uint8_t miso, uint8_t mosi,
                               uint8_t ss) {
  spi_dev = new Adafruit_SPIDevice(ss, clk, miso, mosi, 100000,
      SPI_BITORDER_LSBFIRST, SPI_MODE0);
}


Adafruit_PN532::Adafruit_PN532(uint8_t ss) {
  spi_dev =
      new Adafruit_SPIDevice(ss, 100000, SPI_BITORDER_LSBFIRST, SPI_MODE0);
}


and I get in serial out put: Didn't find PN53x board and it halt. The connection pins is correct I recheck it one more time.
Any one can help me, what is problem and how to fix it? Thanks!

Re: TTGO-T-display + pn532

Posted: Wed Apr 21, 2021 4:33 pm
by Adam M
Did You received any answer / help ? I'm also interested in this topic. :geek: