Topic: about to go crazy, raspberry and pn532 breakout

I spent the whole day, checked and rechecked cables, connection soldering, everything is perfect...
I just can't make it working
raspberry + pn532 breakout board

of course I followed the instructions, connected directly uart port to the board... after spending hours in testing I noted that randomly I get:

pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ ./nfc-poll
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
pn53x_check_communication: Timeout
lt-nfc-poll: ERROR: Unable to open NFC device.
pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ ./nfc-poll
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
pn53x_check_communication: Timeout
lt-nfc-poll: ERROR: Unable to open NFC device.
pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ ./nfc-poll
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
NFC reader: pn532_uart:/dev/ttyAMA0 opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04 
       UID (NFCID1): ad  e3  c9  23 
      SAK (SEL_RES): 08 
pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ ./nfc-poll
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
pn53x_check_communication: Timeout
lt-nfc-poll: ERROR: Unable to open NFC device.
pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ ./nfc-poll
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
pn53x_check_communication: Timeout
lt-nfc-poll: ERROR: Unable to open NFC device.


so .. it worked once... It must work again.
Thought to a timeout problem, incresed the timeout in the driver from 1 to 3 seconds, but .. didn't help

I really don't know what to try more....

thanks for any kind of help,

v

Re: about to go crazy, raspberry and pn532 breakout

to get it worst, if I call nfc-poll with log level bumped up to 3... it works always... this does not have any explanation for me

pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ LIBNFC_LOG_LEVEL=3 ./nfc-poll -v
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
info    libnfc.config    Unable to open file: /etc/nfc/libnfc.conf
debug    libnfc.config    key: [device.name], value: [PN532 board via UART]
debug    libnfc.config    key: [device.connstring], value: [pn532_uart:/dev/ttyAMA0]
debug    libnfc.config    key: [device.allow_intrusive_scan], value: [true]
info    libnfc.config    Unknown key in config line: device.allow_intrusive_scan = true
debug    libnfc.config    key: [device.log_level], value: [5]
info    libnfc.config    Unknown key in config line: device.log_level = 5
debug    libnfc.config    key: [device.allow_autoscan], value: [true]
info    libnfc.config    Unknown key in config line: device.allow_autoscan = true
debug    libnfc.general    log_level is set to 3
debug    libnfc.general    allow_autoscan is set to true
debug    libnfc.general    allow_intrusive_scan is set to false
debug    libnfc.general    1 device(s) defined by user
debug    libnfc.general      #0 name: "PN532 board via UART", connstring: "pn532_uart:/dev/ttyAMA0"
debug    libnfc.driver.pn532_uart    Attempt to open: /dev/ttyAMA0 at 115200 bauds.
debug    libnfc.bus.uart    Serial port speed requested to be set to 115200 bauds.
debug    libnfc.chip.pn53x    Diagnose
debug    libnfc.chip.pn53x    Timeout values: 500
debug    libnfc.bus.uart    TX: 55 55 00 00 00
debug    libnfc.chip.pn53x    SAMConfiguration
debug    libnfc.chip.pn53x    Timeout values: 1000
debug    libnfc.bus.uart    TX: 00 00 ff 03 fd d4 14 01 17 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 15
debug    libnfc.bus.uart    RX: 16 00
debug    libnfc.bus.uart    TX: 00 00 ff 09 f7 d4 00 00 6c 69 62 6e 66 63 be 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 09 f7
debug    libnfc.bus.uart    RX: d5 01
debug    libnfc.bus.uart    RX: 00 6c 69 62 6e 66 63
debug    libnfc.bus.uart    RX: bc 00
debug    libnfc.chip.pn53x    GetFirmwareVersion
debug    libnfc.bus.uart    TX: 00 00 ff 02 fe d4 02 2a 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 06 fa
debug    libnfc.bus.uart    RX: d5 03
debug    libnfc.bus.uart    RX: 32 01 06 07
debug    libnfc.bus.uart    RX: e8 00
debug    libnfc.chip.pn53x    SetParameters
debug    libnfc.bus.uart    TX: 00 00 ff 03 fd d4 12 14 06 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 13
debug    libnfc.bus.uart    RX: 18 00
debug    libnfc.general    "pn532_uart:/dev/ttyAMA0" (pn532_uart:/dev/ttyAMA0) has been claimed.
debug    libnfc.chip.pn53x    ReadRegister
debug    libnfc.bus.uart    TX: 00 00 ff 0c f4 d4 06 63 02 63 03 63 0d 63 38 63 3d b0 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 07 f9
debug    libnfc.bus.uart    RX: d5 07
debug    libnfc.bus.uart    RX: 00 00 00 00 00
debug    libnfc.bus.uart    RX: 24 00
debug    libnfc.chip.pn53x    PN53X_REG_CIU_TxMode (Defines the transmission data rate and framing during transmission)
debug    libnfc.chip.pn53x    PN53X_REG_CIU_RxMode (Defines the transmission data rate and framing during receiving)
debug    libnfc.chip.pn53x    WriteRegister
debug    libnfc.bus.uart    TX: 00 00 ff 08 f8 d4 08 63 02 80 63 03 80 59 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 09
debug    libnfc.bus.uart    RX: 22 00
debug    libnfc.chip.pn53x    RFConfiguration
debug    libnfc.bus.uart    TX: 00 00 ff 04 fc d4 32 01 00 f9 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 33
debug    libnfc.bus.uart    RX: f8 00
debug    libnfc.chip.pn53x    RFConfiguration
debug    libnfc.bus.uart    TX: 00 00 ff 04 fc d4 32 01 01 f8 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 33
debug    libnfc.bus.uart    RX: f8 00
debug    libnfc.chip.pn53x    RFConfiguration
debug    libnfc.bus.uart    TX: 00 00 ff 06 fa d4 32 05 ff ff ff f8 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 33
debug    libnfc.bus.uart    RX: f8 00
NFC reader: pn532_uart:/dev/ttyAMA0 opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
debug    libnfc.chip.pn53x    ReadRegister
debug    libnfc.bus.uart    TX: 00 00 ff 0e f2 d4 06 63 02 63 03 63 05 63 38 63 3c 63 3d 19 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 08 f8
debug    libnfc.bus.uart    RX: d5 07
debug    libnfc.bus.uart    RX: 80 80 00 00 00 00
debug    libnfc.bus.uart    RX: 24 00
debug    libnfc.chip.pn53x    PN53X_REG_CIU_TxAuto (Controls the settings of the antenna driver)
debug    libnfc.chip.pn53x    PN53X_REG_CIU_Control (Contains miscellaneous control bits)
debug    libnfc.chip.pn53x    WriteRegister
debug    libnfc.bus.uart    TX: 00 00 ff 08 f8 d4 08 63 05 40 63 3c 10 cd 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 09
debug    libnfc.bus.uart    RX: 22 00
debug    libnfc.chip.pn53x    InAutoPoll
debug    libnfc.chip.pn53x    No timeout
debug    libnfc.bus.uart    TX: 00 00 ff 0a f6 d4 60 14 02 20 10 03 11 12 04 5c 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 0e f2
debug    libnfc.bus.uart    RX: d5 61
debug    libnfc.bus.uart    RX: 01 10 09 01 00 04 08 04 ad e3 c9 23
debug    libnfc.bus.uart    RX: 23 00
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04 
* UID size: single
* bit frame anticollision supported
       UID (NFCID1): ad  e3  c9  23 
      SAK (SEL_RES): 08 
* Not compliant with ISO/IEC 14443-4
* Not compliant with ISO/IEC 18092

Fingerprinting based on MIFARE type Identification Procedure:
* MIFARE Classic 1K
* MIFARE Plus (4 Byte UID or 4 Byte RID) 2K, Security level 1
* SmartMX with MIFARE 1K emulation
Other possible matches based on ATQA & SAK values:
debug    libnfc.chip.pn53x    InRelease
debug    libnfc.bus.uart    TX: 00 00 ff 03 fd d4 52 00 da 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 03 fd
debug    libnfc.bus.uart    RX: d5 53
debug    libnfc.bus.uart    RX: 00
debug    libnfc.bus.uart    RX: d8 00
debug    libnfc.chip.pn53x    RFConfiguration
debug    libnfc.bus.uart    TX: 00 00 ff 04 fc d4 32 01 00 f9 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 02 fe
debug    libnfc.bus.uart    RX: d5 33
debug    libnfc.bus.uart    RX: f8 00
debug    libnfc.chip.pn53x    PowerDown
debug    libnfc.bus.uart    TX: 00 00 ff 03 fd d4 16 f0 26 00
debug    libnfc.bus.uart    RX: 00 00 ff 00 ff 00
debug    libnfc.chip.pn53x    PN53x ACKed
debug    libnfc.bus.uart    RX: 00 00 ff 03 fd
debug    libnfc.bus.uart    RX: d5 17
debug    libnfc.bus.uart    RX: 00
debug    libnfc.bus.uart    RX: 14 00
pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $

3 (edited by vito.rallo 2013-08-06 22:55:50)

Re: about to go crazy, raspberry and pn532 breakout

i just noticed that the config file is not parsing correctly (from the logs), I am going to patch it and try...

meanwhile, just for the developers here, while recompiling conf.c:

conf.c: In function 'conf_devices_load':
conf.c:185:14: warning: integer overflow in expression [-Woverflow]

patched the file, config load correctly:

debug    libnfc.config    key: [device.name], value: [PN532 board via UART]
debug    libnfc.config    key: [device.connstring], value: [pn532_uart:/dev/ttyAMA0]
debug    libnfc.config    key: [device.allow_intrusive_scan], value: [true]
debug    libnfc.config    key: [device.log_level], value: [3]
debug    libnfc.general    log_level is set to 3
debug    libnfc.general    allow_autoscan is set to true
debug    libnfc.general    allow_intrusive_scan is set to true
debug    libnfc.general    1 device(s) defined by user

still issue not solved when my log_level = 1

pi@raspberrypi ~/src/libnfc/libnfc-1.7.0-rc7/examples $ ./nfc-poll
/home/pi/src/libnfc/libnfc-1.7.0-rc7/examples/.libs/lt-nfc-poll uses libnfc 1.7.0-rc7
pn53x_check_communication: Timeout
lt-nfc-poll: ERROR: Unable to open NFC device.

Re: about to go crazy, raspberry and pn532 breakout

trying with older libnfc 1.5.1 ... there is no really an explanation, same story... working randomly yes and no...

pi@raspberrypi ~/src/libnfc/libnfc-1.5.1/examples $ sudo ./nfc-poll
/home/pi/src/libnfc/libnfc-1.5.1/examples/.libs/lt-nfc-poll uses libnfc 1.5.1 (r)
Connected to NFC reader: PN532 (/dev/ttyAMA0) - PN532 v1.6 (0x07)
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04 
       UID (NFCID1): ad  e3  c9  23 
      SAK (SEL_RES): 08 
pi@raspberrypi ~/src/libnfc/libnfc-1.5.1/examples $ sudo ./nfc-poll
/home/pi/src/libnfc/libnfc-1.5.1/examples/.libs/lt-nfc-poll uses libnfc 1.5.1 (r)
pn53x_check_communication: Operation timed-out
No NFC device found.
pi@raspberrypi ~/src/libnfc/libnfc-1.5.1/examples $ sudo ./nfc-poll
/home/pi/src/libnfc/libnfc-1.5.1/examples/.libs/lt-nfc-poll uses libnfc 1.5.1 (r)
Connected to NFC reader: PN532 (/dev/ttyAMA0) - PN532 v1.6 (0x07)
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04 
       UID (NFCID1): ad  e3  c9  23 
      SAK (SEL_RES): 08 
pi@raspberrypi ~/src/libnfc/libnfc-1.5.1/examples $ sudo ./nfc-poll
/home/pi/src/libnfc/libnfc-1.5.1/examples/.libs/lt-nfc-poll uses libnfc 1.5.1 (r)
pn53x_check_communication: Operation timed-out
No NFC device found.
pi@raspberrypi ~/src/libnfc/libnfc-1.5.1/examples $ sudo ./nfc-poll
/home/pi/src/libnfc/libnfc-1.5.1/examples/.libs/lt-nfc-poll uses libnfc 1.5.1 (r)
Connected to NFC reader: PN532 (/dev/ttyAMA0) - PN532 v1.6 (0x07)
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
ISO/IEC 14443A (106 kbps) target:
    ATQA (SENS_RES): 00  04 
       UID (NFCID1): ad  e3  c9  23 
      SAK (SEL_RES): 08 
pi@raspberrypi ~/src/libnfc/libnfc-1.5.1/examples $ sudo ./nfc-poll
/home/pi/src/libnfc/libnfc-1.5.1/examples/.libs/lt-nfc-poll uses libnfc 1.5.1 (r)
pn53x_check_communication: Operation timed-out
No NFC device found.

Re: about to go crazy, raspberry and pn532 breakout

I am having exact same problem.
I have wired the pn532 as a uart device to the RPi and connected the power pin to the 5v pin on the Pi.  Looking at the app note, it seems to say it should never have more than 3.6v on that pin in a uart application.

Secondly, I have put the nfc-poll in an endless bash script loop and after a cold boot start start of this script, it reads the first MiFare card and keeps timing out after that.
In that state, I can pretty reliably get it to work again by breaking (hitting ctrl-c) out of a running nfc-poll command.
I believe this supports the idea that there is some state it gets stuck in (the idea that it may be missing an ACK or something during a deselect command???).

Anyway, has anybody got this working on thr Pi?
The frustrating part is that the python nfc libraries that I tried don't support MiFare tags that come standard eith the breakout board from Adafruit and guess what the tags are that they seem to push with this card?   
Let's think this through Adafruit...it's a Raspberry Pi so most people want python.  C'mon guys!

Re: about to go crazy, raspberry and pn532 breakout

understand man, thanks for getting back here... I am happy, don't feel alone with this issue anymore.
Yes, I tried the python way, of course but no support for the board. did you find a solution?

Re: about to go crazy, raspberry and pn532 breakout

Hi!

I am having the same problem that it can only poll if i use LIBNFC_LOG_LEVEL=3 and i checked my logs and i get "allow_intrusive_scan is set to false" but in the .conf file i put it to true. Dont know if this is connected but..... please help!