Building libnfc 1.7 to support Adafruit PN532 Breakout Board

Image (c) Adafruit Industries

I Received a new PN532 NFC breakout board from Adafruit today and was attempting to get it to work properly with libnfc.  The instructions linked from the Adafruit docs reference the rather crufty libnfc-1.4; I was able to get this version to build cleanly on my Ubuntu 13.10 laptop, but could only communicate with the breakout board intermittently.  I had no luck at all with the latest code (1.7 as of the time this article was written).  The nfc-list and nfc-poll commands always seemed to return “No NFC device found” with 1.7, and nearly always returned this under 1.4.

Normally I would have dug deeper to find a solution, but I was already pressed for time.  I’ve got a couple of NFC gizmos that I’ve been dying to look into more closely, so I looked around on the Adafruit forums to see if anyone had already solved the issue.

Found this gem on the Adafruit forums here.  Forum user “webnology.ch” posted instructions for building libnfc-1.7 to properly support the Adafruit PN532 NFC breakout board (via USB/UART).  For the sake of posterity:

sudo apt-get install autoconf automake libtool
sudo apt-get install libusb-0.1-4 libusb-dev libpcsclite1 libpcsclite-dev libccid pcscd
sudo apt-get install git
sudo git clone https://code.google.com/p/libnfc/
cd libnfc
mkdir /etc/nfc
mkdir /etc/nfc/devices.d/
sudo nano /etc/nfc/devices.d/pn532_via_uart2usb.conf

paste the following 5 lines into the pn532_via_uart2usb.conf:

## Typical configuration file for PN532 board (ie. microbuilder.eu / Adafruit) device
name = “Adafruit PN532 board via UART”
connstring = pn532_uart:/dev/ttyUSB0
allow_intrusive_scan = true
log_level = 3

sudo autoreconf -vis
./configure --prefix=/usr --with-drivers=pn532_uart --sysconfdir=/etc
sudo make clean
sudo make
sudo make install all
cd examples
sudo ./nfc-poll

I was able to confirm functionality with these instructions.  Hopefully this helps some folks out…

Leave a Reply

Your email address will not be published. Required fields are marked *