1 (edited by myjo 2011-12-05 10:26:56)

Topic: [solved] NFC - PN532 uart (nfc-poll and nfc-list problems)

Hi everyone !

I am pretty new to NFC and I am experiencing an issue while trying to use some of the applications provided by libnfc.
I have a PN532 NFC/RFID controller breakout board as reader and I use a Philips MIFARE card (provided with the board). The board is connected to a Linux environment by means of an uart connection.


I would like some help about 2 things.

I have successfully installed the libnfc (with the parameters --with-drivers=pn532_uart – enable-serial-autoprobe)

When I realize a “nfc-anticol”, I obtain this :

$ nfc-anticol 
Connected to NFC reader: PN532 (/dev/ttyS0) - PN532 v1.6 (0x07)

Sent bits:     26 (7 bits)
Received bits: 04  00  
Sent bits:     93  20  
Received bits: 3e  65  4b  9a  8a  
Sent bits:     93  70  3e  65  4b  9a  8a  e9  7b  
Received bits: 08  b6  dd  
Sent bits:     50  00  57  cd  

Found tag with
 UID: 3e654b9a
ATQA: 0004
 SAK: 08
 

The card seems to be correctly found.

(I have also installed “nfcutils” and with a “lsnfc”, I obtain :

$ lsnfc 
device = PN532 (/dev/ttyS0) - PN532 v1.6 (0x07)
UID=3e654b9a
Several possible matches:
* NXP MIFARE Classic 1k
* NXP MIFARE Plus 1k
1 tag(s) on device.

)

The problem appears when I use “nfc-list” and “nfc-poll”.
With nfc-list, the device is found but there is an “infinite loop” and I don't think it is correct according to the nfc-list example in the libnfc documentation.

$ nfc-list 
nfc-list use libnfc 1.4.2 (r891)
Connected to NFC device: PN532 (/dev/ttyS0) - PN532 v1.6 (0x07)
1 ISO14443A passive target(s) was found:
    ATQA (SENS_RES): 00  04  
       UID (NFCID1): 3e  65  4b  9a  
      SAK (SEL_RES): 08  


(and nothing else...)

I have the same result with “nfc-poll” :

$ nfc-poll 
nfc-poll use libnfc 1.4.2 (r891)
Connected to NFC reader: PN532 (/dev/ttyS0) - PN532 v1.6 (0x07)
PN532 will poll during 30000 ms

(and nothing else...)

Is there someone having experienced such issue?

PS: When I realize a nfc-list with debug enabled, I obtain the same result with more lines of DBG. But about some seconds, there is only an “infinite” line displayed:

nfc-list: DBG uart_posix.c:219
nfc-list:     iExpectedByteCount == 0

So I think the infinite loop is due to this iExpectedByteCount... I tried to see the uart_posix.c file but I don't really see how to solve the problem.


My second question is regarding reading / writing data from / to the card.
I use the “nfc-mfclassic r a test.mfd” tool to read the data from the card and I obtain the file which looks like the example file: http://www.libnfc.org/_detail/libnfc/do … mfclassic.

I would like to know what means the “a” or “b” key in the command line? And do you know what are the “key blocks” in the file?


Sorry for all these questions and thank you very much for any help !

Re: [solved] NFC - PN532 uart (nfc-poll and nfc-list problems)

Hello,

First, to use libnfc with a UART based device, you should use an unstable version (see in download section) or the developement version of libnfc (svn).

Many UART-related problems have been fixed right after 1.4.2 release (use 1.5.x series).

Romuald Conty

Re: [solved] NFC - PN532 uart (nfc-poll and nfc-list problems)

Hello,

Thank you for your reply !
I did not think that I must use an unstable version. I will try the 1.5.x series but I succeeded in what I was trying to do.
The libnfc is very powerful !

Best regards,

Re: [solved] NFC - PN532 uart (nfc-poll and nfc-list problems)

Hello,

myjo, how were you able to solve this? i am encountering the same problem using the pn532 breakout board v1.3. I have tried using both the 1.4.2 and 1.5.1 versions of libnfc. I also cannot find the nfc-list command on version 1.5.1

Re: [solved] NFC - PN532 uart (nfc-poll and nfc-list problems)

jedx wrote:

Hello,

myjo, how were you able to solve this? i am encountering the same problem using the pn532 breakout board v1.3. I have tried using both the 1.4.2 and 1.5.1 versions of libnfc. I also cannot find the nfc-list command on version 1.5.1


Hi Jedx,

I have the PN532 but the old version (1.2) and not the 1.3 but I do not think that it changes many things.

For the libnfc, I have used the library version 1.5.0 & 1.5.1 & 1.6.0 and the nfc-list function works.
Do not use the 1.4.2. The function works but never ends (see my problem in this topic).

Once you have compiled libnfc (with uart options, for me it is :

./configure --with-drivers=pn532_uart --enable-serial-autoprobe

), you can find the example nfc-list in the folder of libnfc/utils or by using ¨nfc-list¨ in a terminal if you are under linux :

nfc-list

Hope I helped you.
If you need more information or help, do not hesitate.

Myjo

6 (edited by editor 2012-11-19 02:12:47)

Re: [solved] NFC - PN532 uart (nfc-poll and nfc-list problems)

myjo, I'm guessing you're using a FTDI cable or adapter. I had run into similar issues and it took me a while to realize that it was OS X that wasn't recognizing the board, not libnfc.

An OS X equivalent of "lsusb" is "system_profiler SPUSBDataType" and if you can see somethere there like this, but don't see the device in nfc-list, nfc-poll or  pn53x-diagnose I would suggest you check whether you've got the FTDI drivers installed

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

            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