I'm using Pi4J library to read data from a NFC reader based on PN532, connected to my Pi via SPI. However, I don't seem to receive any data from if when I put a NFC card to my reader.

I'm using SPI0 channel. I'm using Pi4J, a Java wrapper for WiringPi. Here's my code:

import com.pi4j.wiringpi.Spi;
import java.util.Arrays;

// ...

int initResult = Spi.wiringPiSPISetup(0, 500000); 
// initResult  == 27, so no error

// ...

int len = 8;
byte[] data = new byte[len];
Arrays.fill(data, (byte)0);
int result = Spi.wiringPiSPIDataRW(0, data, len); 
// result == 8, so no error

I get 8 as a result of wiringPiSPIDataRW (-1 would indicate an error, so I guess that's good), but my data is still empty (as in, full of 0) regardless if I put my NFC card to the reader or not.

PN532 can be set to either SPI or I2C, I'm sure it's set to SPI properly.

Included are the photos of my connections. My pinout reference is this one

Raspberry pins

PN532 front

PN532 back

What am I missing?

  • 1
    A clear photo of the connections between the Pi and module. A clear photo of the module (front and back).
    – joan
    Dec 30, 2019 at 18:49
  • @joan I've included photos and a link to my reference for RPi pinout
    – mag_zbc
    Dec 30, 2019 at 19:06


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.