Topic: Works only second run. Bug ?
Hello All,
Few days ago I started some development with RFID and libnfc.
I encountered weird problem related to my PN532_uart reader (Adafruits board)
For past two days everything seems to work ok, and then after system kernel upgrade (2.6.32 -> 3.1.10) weird thing started to happend.
Exactly every second run I success with nfc-poll, nfc-mfclassic and other is failure. You will find sample session below.
I was thinking that this might be a kernel problem but after switch back to old one problem still exists :-) I've tried to build nfc 1.4.2, 1.5.x 1.6(rc).
I started suspec my reader that it is broken..is it possible with such symptoms ?
This looks somehow related to sending data over USB, but I tried different USB-UART chips (PL2302, FT232RL). No success, and problem sill exists.
When running strace on nfc-pool results are:
For OK:
open("/dev/ttyUSB0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
[cut some stuff]
write(3, "\0\0\377\3\375\324\24\1\27\0", 10) = 10
select(4, [3], NULL, NULL, {1, 0}) = 1 (in [3], left {0, 996974})
For BAD attempt this looks like this:
open("/dev/ttyUSB0", O_RDWR|O_NOCTTY|O_NONBLOCK) = 3
write(3, "\0\0\377\3\375\324\24\1\27\0", 10) = 10
select(4, [3], NULL, NULL, {1, 0}) = 0 (Timeout)
Does anybody had similar symptoms ?
I' looked in code for maybe some not closed usb descriptors,etc...everything seems to be ok. The only tool that is working almost always is pn53x-diagnose.
Below sample session: ![]()
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
nfc-poll: ERROR: Unable to open NFC device.
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
NFC reader: pn532_uart:/dev/ttyUSB0 - PN532 v1.6 (0x07) opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
^Cnfc_initiator_poll_target: Success
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
nfc-poll: ERROR: Unable to open NFC device.
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
NFC reader: pn532_uart:/dev/ttyUSB0 - PN532 v1.6 (0x07) opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
^Cnfc_initiator_poll_target: Success
spock@aone ~/libnfc-read-only %
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
nfc-poll: ERROR: Unable to open NFC device.
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
NFC reader: pn532_uart:/dev/ttyUSB0 - PN532 v1.6 (0x07) opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
^Cnfc_initiator_poll_target: Success
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
nfc-poll: ERROR: Unable to open NFC device.
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
NFC reader: pn532_uart:/dev/ttyUSB0 - PN532 v1.6 (0x07) opened
NFC device will poll during 30000 ms (20 pollings of 300 ms for 5 modulations)
^Cnfc_initiator_poll_target: Success
spock@aone ~/libnfc-read-only % nfc-poll
nfc-poll uses libnfc 1.6.0-rc1 (r1327)
nfc-poll: ERROR: Unable to open NFC device.
spock@aone ~/libnfc-read-only % pn53x-diagnose
pn53x-diagnose uses libnfc 1.6.0-rc1 (r1327)
NFC device [pn532_uart:/dev/ttyUSB0 - PN532 v1.6 (0x07)] opened.
Communication line test: OK
ROM test: OK
RAM test: OK
spock@aone ~/libnfc-read-only % pn53x-diagnose
pn53x-diagnose uses libnfc 1.6.0-rc1 (r1327)
NFC device [pn532_uart:/dev/ttyUSB0 - PN532 v1.6 (0x07)] opened.
Communication line test: OK
ROM test: OK
RAM test: OK
Spock
Thanks is advance.