Roverok / libnfc

Automatically exported from code.google.com/p/libnfc
GNU Lesser General Public License v3.0
0 stars 0 forks source link

PN532 UART support broken/unstable #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add a default PN532 NXP's demo-board.
2. Compile libnfc with option "--with-drivers=pn532_uart 
--enable-serial-autoprobe".
3. Put a tag on the antenna and launch "nfc-list".

What is the expected output? What do you see instead?

This is the output of nfc-list execution:

Connected to NFC reader: PN532 (/dev/ttyUSB0) - PN532 v1.6 (0x07)

 TX: 00  00  ff  04  fc  d4  4a  01  00  e1  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  09  f7  d4  4a  01  01  00  ff  ff  00  00  e2  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  09  f7  d4  4a  01  02  00  ff  ff  00  00  e1  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  05  fb  d4  4a  01  03  00  de  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  04  fc  d4  4a  01  04  dd  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  03  fd  d4  44  00  e8  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  45  00  e6  00  
 RX: 00  00  ff  03  fd  d5  45  00  e6  00  
 TX: 00  00  ff  04  fc  d4  32  01  00  f9  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  33  f8  00  
 RX: 00  00  ff  02  fe  d5  33  f8  00 

So no tag found.

Original issue reported on code.google.com by emanuele.bertoldi on 11 Jun 2010 at 3:55

GoogleCodeExporter commented 9 years ago
Your device seems to reply correctly... I can't any point that can affect the 
tag detection.

Original comment by romu...@libnfc.org on 11 Jun 2010 at 4:12

GoogleCodeExporter commented 9 years ago
I ran a test with a PN532 UART, all goes fine for me. Could you double check 
that your reader doesn't read tags ? If its the case, please post a FULL debug 
log of a working revision and a FULL debug log of current trunk. Thanks.

Original comment by romu...@libnfc.org on 14 Jun 2010 at 8:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Mmmm...after more tests it seems to work. Probably the problem was a conflict 
with a previous source tree.

Sorry for the invalid report.

Original comment by emanuele.bertoldi on 14 Jun 2010 at 1:21

GoogleCodeExporter commented 9 years ago
It seems there is something wrong with serial I/O buffers reset: they seem to 
not be immediately cleaned after a I/O error.

The result is something like this:

// previous libnfc computation //
nfc-something: ERROR: Unable to receive data. (RX)
// new libnfc computation //
nfc-something
nfc-something use libnfc 1.3.9 (r433)
nfc-something: INFO: No device found.

Original comment by emanuele.bertoldi on 16 Jun 2010 at 10:19

GoogleCodeExporter commented 9 years ago

Original comment by emanuele.bertoldi on 16 Jun 2010 at 10:20

GoogleCodeExporter commented 9 years ago
Could you put more explainations about this problem ?

Do you have any patches or hacks ?

Original comment by romu...@libnfc.org on 20 Jul 2010 at 1:50

GoogleCodeExporter commented 9 years ago
The problem is evident in my new example "nfc-sam" if you choose VIRTUAL or 
DUAL modes, so probably it appears after a "SAMConfiguration" command.

Original comment by emanuele.bertoldi on 22 Jul 2010 at 1:49

GoogleCodeExporter commented 9 years ago
I've found a more clear test-case for this issue:

================================================================================
====

zuck@zuck-laptop:~$ nfc-list
nfc-list use libnfc 1.3.9 (r453)

Connected to NFC reader: PN532 (/dev/ttyUSB0) - PN532 v1.6 (0x07)

nfc-list: ERROR: Unable to receive data. (RX)
zuck@zuck-laptop:~$ nfc-list
nfc-list use libnfc 1.3.9 (r453)
nfc-list: ERROR: Unable to receive data. (RX)
nfc-list: ERROR: Unable to connect to NFC device.
zuck@zuck-laptop:~$ nfc-list
nfc-list use libnfc 1.3.9 (r453)

Connected to NFC reader: PN532 (/dev/ttyUSB0) - PN532 v1.6 (0x07)

================================================================================
====

I've launched the "nfc-list" command three times.

Original comment by emanuele.bertoldi on 26 Jul 2010 at 8:04

GoogleCodeExporter commented 9 years ago
Could you run the same with debug enabled, please ?
At the moment, I haven't material to test myself, have you some idea about this 
problem ?

Original comment by romu...@libnfc.org on 26 Jul 2010 at 12:41

GoogleCodeExporter commented 9 years ago

Original comment by romu...@libnfc.org on 26 Jul 2010 at 12:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
zuck@zuck-laptop:$ nfc-list
nfc-list use libnfc 1.3.9 (r453)
nfc-list: DBG nfc.c:112
nfc-list:     List avaible device using PN532_UART driver
nfc-list: DBG pn532_uart.c:122
nfc-list:     Trying to find PN532 device on serial port: /dev/ttyUSB0 at 
115200 bauds.
nfc-list: DBG uart.c:111
nfc-list:     Serial port speed requested to be set to 115200 bauds.
 TX: 55  55  00  00  00  
 TX: 00  00  ff  09  f7  d4  00  00  6c  69  62  6e  66  63  be  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  09  f7  d5  01  00  6c  69  62  6e  66  63  bc  00  
nfc-list: DBG pn532_uart.c:140
nfc-list:     Device found: PN532 (/dev/ttyUSB0).
nfc-list: DBG pn532_uart.c:122
nfc-list:     Trying to find PN532 device on serial port: /dev/ttyUSB1 at 
115200 bauds.
nfc-list: DBG pn532_uart.c:147
nfc-list:     Invalid serial port: /dev/ttyUSB1
nfc-list: ...  [CUT]
nfc-list: DBG nfc.c:117
nfc-list:     1 device(s) found using PN532_UART driver
nfc-list: DBG nfc.c:174
nfc-list:     Looking for PN532_UART, found PN532_UART... Use it.
nfc-list: DBG pn532_uart.c:164
nfc-list:     Connecting to: /dev/ttyUSB0 at 115200 bauds.
nfc-list: DBG uart.c:111
nfc-list:     Serial port speed requested to be set to 115200 bauds.
 TX: 55  55  00  00  00  
 TX: 00  00  ff  09  f7  d4  00  00  6c  69  62  6e  66  63  be  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  09  f7  d5  01  00  6c  69  62  6e  66  63  bc  00  
nfc-list: DBG pn532_uart.c:178
nfc-list:     Successfully connected to: /dev/ttyUSB0
nfc-list: DBG nfc.c:182
nfc-list:     [PN532 (/dev/ttyUSB0)] has been claimed.
 TX: 00  00  ff  02  fe  d4  02  2a  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  06  fa  d5  03  32  01  06  07  e8  00  
 RX: 00  00  ff  06  fa  d5  03  32  01  06  07  e8  00  
 TX: 00  00  ff  04  fc  d4  06  63  3d  86  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  00  24  00  
 RX: 00  00  ff  03  fd  d5  07  00  24  00  
 TX: 00  00  ff  05  fb  d4  08  63  3d  00  84  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  02  c1  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  80  a4  00  
 RX: 00  00  ff  03  fd  d5  07  80  a4  00  
 TX: 00  00  ff  05  fb  d4  08  63  02  80  3f  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  03  c0  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  84  a0  00  
 RX: 00  00  ff  03  fd  d5  07  84  a0  00  
 TX: 00  00  ff  05  fb  d4  08  63  03  84  3a  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  0d  b6  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  00  24  00  
 RX: 00  00  ff  03  fd  d5  07  00  24  00  
 TX: 00  00  ff  05  fb  d4  08  63  0d  00  b4  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  38  8b  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  05  1f  00  
 RX: 00  00  ff  03  fd  d5  07  05  1f  00  
 TX: 00  00  ff  05  fb  d4  08  63  38  05  84  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  05  be  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  20  04  00  
 RX: 00  00  ff  03  fd  d5  07  20  04  00  
 TX: 00  00  ff  05  fb  d4  08  63  05  60  5c  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  3c  87  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  10  14  00  
 RX: 00  00  ff  03  fd  d5  07  10  14  00  
 TX: 00  00  ff  05  fb  d4  08  63  3c  10  75  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  32  01  00  f9  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  33  f8  00  
 RX: 00  00  ff  02  fe  d5  33  f8  00  
 TX: 00  00  ff  06  fa  d4  32  05  00  00  00  f5  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  33  f8  00  
 RX: 00  00  ff  02  fe  d5  33  f8  00  
 TX: 00  00  ff  04  fc  d4  06  63  02  c1  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  80  a4  00  
 RX: 00  00  ff  03  fd  d5  07  80  a4  00  
 TX: 00  00  ff  05  fb  d4  08  63  02  80  3f  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  03  c0  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  84  a0  00  
 RX: 00  00  ff  03  fd  d5  07  84  a0  00  
 TX: 00  00  ff  05  fb  d4  08  63  03  84  3a  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  06  63  0d  b6  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  07  00  24  00  
 RX: 00  00  ff  03  fd  d5  07  00  24  00  
 TX: 00  00  ff  05  fb  d4  08  63  0d  00  b4  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  09  22  00  
 RX: 00  00  ff  02  fe  d5  09  22  00  
 TX: 00  00  ff  04  fc  d4  32  01  01  f8  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  33  f8  00  
 RX: 00  00  ff  02  fe  d5  33  f8  00  

Connected to NFC reader: PN532 (/dev/ttyUSB0) - PN532 v1.6 (0x07)

 TX: 00  00  ff  04  fc  d4  4a  01  00  e1  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  09  f7  d4  4a  01  01  00  ff  ff  00  00  e2  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  09  f7  d4  4a  01  02  00  ff  ff  00  00  e1  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  05  fb  d4  4a  01  03  00  de  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  04  fc  d4  4a  01  04  dd  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  4b  00  e0  00  
 RX: 00  00  ff  03  fd  d5  4b  00  e0  00  
 TX: 00  00  ff  03  fd  d4  44  00  e8  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  03  fd  d5  45  00  e6  00  
 RX: 00  00  ff  03  fd  d5  45  00  e6  00  
 TX: 00  00  ff  04  fc  d4  32  01  00  f9  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  02  fe  d5  33  f8  00  
 RX: 00  00  ff  02  fe  d5  33  f8  00

zuck@zuck-laptop:$ nfc-list
nfc-list use libnfc 1.3.9 (r453)
nfc-list: DBG nfc.c:112
nfc-list:     List avaible device using PN532_UART driver
nfc-list: DBG pn532_uart.c:122
nfc-list:     Trying to find PN532 device on serial port: /dev/ttyUSB0 at 
115200 bauds.
nfc-list: DBG uart.c:111
nfc-list:     Serial port speed requested to be set to 115200 bauds.
 TX: 55  55  00  00  00  
 TX: 00  00  ff  09  f7  d4  00  00  6c  69  62  6e  66  63  be  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  09  f7  d5  01  00  6c  69  62  6e  66  63  bc  00  
nfc-list: DBG pn532_uart.c:140
nfc-list:     Device found: PN532 (/dev/ttyUSB0).
nfc-list: DBG pn532_uart.c:122
nfc-list:     Trying to find PN532 device on serial port: /dev/ttyUSB1 at 
115200 bauds.
nfc-list: DBG pn532_uart.c:147
nfc-list:     Invalid serial port: /dev/ttyUSB1
nfc-list: DBG pn532_uart.c:122
nfc-list:     Trying to find PN532 device on serial port: /dev/ttyUSB2 at 
115200 bauds.
nfc-list: ...  [CUT]
nfc-list: DBG nfc.c:117
nfc-list:     1 device(s) found using PN532_UART driver
nfc-list: DBG nfc.c:174
nfc-list:     Looking for PN532_UART, found PN532_UART... Use it.
nfc-list: DBG pn532_uart.c:164
nfc-list:     Connecting to: /dev/ttyUSB0 at 115200 bauds.
nfc-list: DBG uart.c:111
nfc-list:     Serial port speed requested to be set to 115200 bauds.
 TX: 55  55  00  00  00  
 TX: 00  00  ff  09  f7  d4  00  00  6c  69  62  6e  66  63  be  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  09  f7  d5  01  00  6c  69  62  6e  66  63  bc  00  
nfc-list: DBG pn532_uart.c:178
nfc-list:     Successfully connected to: /dev/ttyUSB0
nfc-list: DBG nfc.c:182
nfc-list:     [PN532 (/dev/ttyUSB0)] has been claimed.
 TX: 00  00  ff  02  fe  d4  02  2a  00  
 RX: 00  00  ff  00  ff  00  00  00  ff  06  fa  d5  03  32  01  06  07  e8  00  
 RX: 00  00  ff  06  fa  d5  03  32  01  06  07  e8  00  
 TX: 00  00  ff  04  fc  d4  06  63  3d  86  00  
nfc-list: DBG uart.c:221
nfc-list:     RX time-out, buffer empty.
nfc-list: ERROR: Unable to receive data. (RX)
 TX: 00  00  ff  05  fb  d4  08  63  3d  00  84  00  
nfc-list: DBG uart.c:221
nfc-list:     RX time-out, buffer empty.
nfc-list: ERROR: Unable to receive data. (RX)
nfc-list: ERROR: Unable to connect to NFC device.

zuck@zuck-laptop:$  

Original comment by emanuele.bertoldi on 26 Jul 2010 at 3:55

GoogleCodeExporter commented 9 years ago
May be fixed by r473, r474.

Original comment by romu...@libnfc.org on 29 Jul 2010 at 3:07

GoogleCodeExporter commented 9 years ago
Zuck, can you test and confirm that Romulad's modification fixed this issue?

Thanks!

Original comment by romain.t...@gmail.com on 6 Aug 2010 at 10:08

GoogleCodeExporter commented 9 years ago
It helps but doesn't resolve completely the problem...

Original comment by emanuele.bertoldi on 6 Aug 2010 at 12:38

GoogleCodeExporter commented 9 years ago
Should be fixed in r539.
Zuck, could you confirm that it now works fine ?

Original comment by romu...@libnfc.org on 18 Aug 2010 at 8:09

GoogleCodeExporter commented 9 years ago
May be broken by r566.

If the code in trunk fails after r566, please try at revision 565 and tell us.  
Thanks!

Original comment by romain.t...@gmail.com on 20 Aug 2010 at 11:23

GoogleCodeExporter commented 9 years ago
It works for me and without any opposed feedback, I consider this issue closed.
Please re-open (with a way to reproduce the bug and debug trace -using 
pastebin-) this issue.

Original comment by romu...@libnfc.org on 31 Aug 2010 at 1:01

GoogleCodeExporter commented 9 years ago
Not all problems are fixed but you're right: it's better to close this issue 
and reopen it when we have some ways to reproduce the bug.

Original comment by emanuele.bertoldi on 31 Aug 2010 at 2:36