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…
had to run:
sudo apt-get install pkg-config libtool
to get ./configure and make working
still doesnt work. cannot for the life of me figure it out, spent at least 24 hours on this.
using the same board and setup, running an ubuntu 18 VM. kill me
whygod@whygod:~/Downloads/libnfc-libnfc-1.7.0/examples$ sudo nfc-poll
[sudo] password for whygod:
nfc-poll uses libnfc 1.7.0
pn53x_check_communication: Timeout
nfc-poll: ERROR: Unable to open NFC device.
whygod@whygod:~/Downloads/libnfc-libnfc-1.7.0/examples$ nfc-poll
nfc-poll uses libnfc 1.7.0
error libnfc.driver.pn532_uart Invalid serial port: /dev/ttyUSB0
nfc-poll: ERROR: Unable to open NFC device.
whygod@whygod:~/Downloads/libnfc-libnfc-1.7.0/examples$ ^C
whygod@whygod:~/Downloads/libnfc-libnfc-1.7.0/examples$
Unsurprising – I wrote this up after beating my head against the wall for far too long. I feel your pain, brother! If you do get it working let me know and we can update the article.