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
8 as a result of
-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
What am I missing?