Raspberry Pi How To: Connect PN532 RFID NFC reader

Connecting the PN532 to the Raspberry Pi can be challenging unless you follow the required steps.

The easiest way to get up and running quickly is to use libnfc.

 

Here is the link to the nfc library source

https://github.com/nfc-tools/libnfc.git

And here are the instructions how to build the library for the Raspberry Pi:

https://learn.adafruit.com/adafruit-nfc-rfid-on-raspberry-pi/building-libnfc

 

In case of a I2C connection the Adafruit PN532 board needs a couple of pull-up resistors as shown here.

 

 

Testing:

the example directory of libnfc contains a "nfc-poll" which is great for testing the PN532 functions.

Disable NFC library

A USB connected NFC device (e.g.ACR122) will automatically be claimed by the NFC kernel module which is loaded by default on Wheezy.
The loading of the kernel module can be prevented by creating the following file:

/etc/modprobe.d/blacklist-libnfc.conf
blacklist nfc
blacklist pn532

To temporarily release the device from the kernel module:

rmmod pn532
rmmod nfc

disconnect/reconnect of the device will cause the modules to reload.