PN532 Breakout Board - undetected with libnfc

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
nofiretruckingclue
 
Posts: 3
Joined: Thu Jul 14, 2011 6:39 am

PN532 Breakout Board - undetected with libnfc

Post by nofiretruckingclue »

I'm not sure if I should be asking here or the libnfc forums - so mods nuke this if that's the case and I'll take the question there.

I've got my breakout board connected up with a FTDI FT232RL to my Mac and the jumpers set to UART, with the USB serial connection showing up as "tty.usbserial-A8004wbx" in /dev/. Grabbed the source of libnfc, configured and made it with the "--with-drivers=pn532_uart --enable-serial-autoprobe --enable-debug" flags set, and once it's made, run nfc-list.

Code: Select all

$ nfc-list
nfc-list use libnfc 1.5.0 (r1019)
nfc-list: DBG nfc.c:227
nfc-list:     0 device(s) found using PN532_UART driver
No NFC device found.
No dice. Let's go poke around the source code and see where this magic is supposed to be happening.

Code: Select all

$ ack UART
...
libnfc/buses/uart_posix.c
46:#  if defined(__APPLE__)
47:char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", NULL };
...
Well, there's a starting point. Let's try and fix that.

Code: Select all

$ git diff
diff --git a/libnfc/buses/uart_posix.c b/libnfc/buses/uart_posix.c
index b430287..5a2a104 100644
--- a/libnfc/buses/uart_posix.c
+++ b/libnfc/buses/uart_posix.c
@@ -47,7 +47,7 @@
 
 #  if defined(__APPLE__)
   // FIXME: find UART connection string for PN53X device on Mac OS X when multiples devices are used
-char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", NULL };
+char *serial_ports_device_radix[] = { "tty.usbserial-A8004wbx", NULL };
Let's hose the old install, and get this fix compiled and working.

Code: Select all

$ nfc-list
nfc-list:     0 device(s) found using PN532_UART driver
No NFC device found.
So this is where I'm at. The device works great when it's wired up to my Arduino, but I'm having a hell of a time getting this to play on my Mac. Any suggestions on what I should do to try and get this playing ball?

Thanks

User avatar
scott_42
 
Posts: 130
Joined: Mon May 30, 2011 10:46 am

Re: PN532 Breakout Board - undetected with libnfc

Post by scott_42 »

I've never heard of libnfc but by looking at the code, this looks like what you are after.

Try changing this:

Code: Select all

line 50:
char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", NULL };

line 347:
        if (!isdigit (pdDirEnt->d_name[strlen (pdDirEnt->d_name) - 1]))
            continue;
to this:

Code: Select all

line 50:
char *serial_ports_device_radix[] = { "tty.SLAB_USBtoUART", "tty.usbserial-", NULL };

line 347:
//        if (!isdigit (pdDirEnt->d_name[strlen (pdDirEnt->d_name) - 1]))
//            continue;

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by adafruit »

we had more luck with 1.4 than 1.5 (for unknown reasons)

nofiretruckingclue
 
Posts: 3
Joined: Thu Jul 14, 2011 6:39 am

Re: PN532 Breakout Board - undetected with libnfc

Post by nofiretruckingclue »

scott-42 wrote:I've never heard of libnfc but by looking at the code, this looks like what you are after.
Thank you, that works flawlessly.

jsilva
 
Posts: 2
Joined: Thu Sep 22, 2011 3:49 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by jsilva »

it worked perfectly as well for me.

regards

User avatar
adamharv
 
Posts: 3
Joined: Sun Dec 05, 2010 6:49 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by adamharv »

That was a great tip. Thanks! Worked for me too with libnfc 1.6.0-rc1 (r1326)

Analogfilter
 
Posts: 1
Joined: Sun May 06, 2012 2:10 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by Analogfilter »

Hello! I'm completely new to this topic.
I installed libnfc 1.6.0-rc1 on my OS X 10.7., modified the lines in uart_posix.c in libnfc/buses/ and connected the UART Pins of my PN532 to my USB via FTDI cable, but ./nfc-list still does not find any NFC devices? How can that be?
Thanks in advance

User avatar
ktownsend
 
Posts: 1447
Joined: Thu Nov 05, 2009 2:18 am

Re: PN532 Breakout Board - undetected with libnfc

Post by ktownsend »

You can have a look at the PN532 wiki for what worked for me with a Mac: http://www.ladyada.net/products/rfidnfc/libnfc.html

User avatar
editor
 
Posts: 1
Joined: Sun Nov 18, 2012 10:46 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by editor »

If you're using the UART driver with a FTDI USB cord and see the device as connected (with the red light on) but it doesn't show up in nfc-poll or pn52x-diagnose, it might be a good idea to make sure you've got the FTDI drivers installed.

http://www.ftdichip.com/Drivers/VCP.htm

This is not mentioned in the NFC tutorials I've seen, but is a pre-requisite for working with an FTDI cable. I've found out the hard way that libnfc can't see your device if the operating system won't let it.

One way to make sure the device is connected on OS X is to run the "lsusb"-like command `system_profiler SPUSBDataType`. Look for something like the following as evidence:

TTL232R-3V3:
Product ID: 0x0001
Vendor ID: 0x0e0f (VMWare, Inc.)
Version: 6.00
Serial Number: FTFXIBK7
Speed: Up to 12 Mb/sec
Manufacturer: FTDI
Location ID: 0xfd120000 / 4
Current Available (mA): 500
Current Required (mA): 90

User avatar
katy
 
Posts: 9
Joined: Tue Feb 23, 2016 5:30 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by katy »

Apologies for resurrecting an old topic: let me know if you'd rather I post a new one.

libnfc seems to have moved on somewhat since this topic was posted. Has anyone successfully communicated with the PN532 using an FTDI cable on OSX El Capitan?

Will continue investigating and post here if I have a solution.

User avatar
scott_42
 
Posts: 130
Joined: Mon May 30, 2011 10:46 am

Re: PN532 Breakout Board - undetected with libnfc

Post by scott_42 »

katy wrote:Has anyone successfully communicated with the PN532 using an FTDI cable on OSX El Capitan?
I haven't played with this in years but it still works with OS X El Capitan (10.11.4 15E65) and I tested with libnfc 1.4.2 since that is what I was able to rebuild at the moment.

Code: Select all

% uname -a
Darwin bug.home.garlicsoftware.com 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64

Code: Select all

% nfc-list
/usr/local/src/libnfc-1.4.2/examples/.libs/nfc-list use libnfc 1.4.2 (r891)
Connected to NFC device: PN532 (/dev/tty.usbserial-A4007TBx) - PN532 v1.6 (0x07)
1 ISO14443A passive target(s) was found:
    ATQA (SENS_RES): 00  04  
       UID (NFCID1): 8e  19  ea  40  
      SAK (SEL_RES): 08  

User avatar
katy
 
Posts: 9
Joined: Tue Feb 23, 2016 5:30 pm

Re: PN532 Breakout Board - undetected with libnfc

Post by katy »

Thanks @scott_42. The solution I ended up going with is this great library: https://github.com/techniq/node-pn532

It's possible libnfc 1.7 works a bit differently, or there's something wrong with the FTDI drivers. I couldn't get it to work on my Ubuntu partition either.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”