wangganggithub / mfocuino

Automatically exported from code.google.com/p/mfocuino
1 stars 1 forks source link

Using this with a PN532 breakout board #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to use the nfc driver with this board 
(http://www.ebay.com/itm/PN532-NFC-RFID-Controller-Breakout-Board-For-Arduino-UN
O-Mega-2560-A124-/261124109868) without luck.

I downloaded the last libnfc (1.7), applied the patch and uploaded de nfc 
driver to my Arduino UNO but if i do ./nfc-list the board is not recognized.

Example debug output:
debug    libnfc.bus.uart    Serial port speed requested to be set to 9600 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    Timeout!
debug    libnfc.driver.pn532_uart    Unable to read ACK
pn53x_check_communication: Timeout

Using a serial sniffer it appears that the board is sending some kind of reply 
(FF FF, sometimes only FF), but that is after the communication error.

Any ideas?

Thanks!

Original issue reported on code.google.com by Christia...@gmail.com on 7 Jan 2014 at 1:14

GoogleCodeExporter commented 9 years ago
Hi,

i have the same error, but not the same board like you and not the one from 
seedstudios or adafruit. So did you have a solution now?

tobi

Original comment by tobiasfu...@gmail.com on 10 Feb 2014 at 1:20

GoogleCodeExporter commented 9 years ago
Hello,

I "solved" the problem using libnfc-1.7.0-rc1 instead of the lastest one. I 
based on this article 
http://regnerischernachmittag.wordpress.com/2013/05/13/libnfc-mit-arduino-nfc-sh
ield-nutzen/

I think that the patch is incompatible with the lastest libnfc.

Original comment by Christia...@gmail.com on 10 Feb 2014 at 11:03

GoogleCodeExporter commented 9 years ago
yeah i see this article, i also found a solution, but with the newest source 
code:

i added sleep(4); to /libnfc/libnfc/drivers/pn532_uart.c

int
pn532_uart_wakeup(nfc_device *pnd)
{
  /* High Speed Unit (HSU) wake up consist to send 0x55 and wait a "long" delay for PN532 being wakeup. */
  const uint8_t pn532_wakeup_preamble[] = { 0x55, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
  int res = uart_send(DRIVER_DATA(pnd)->port, pn532_wakeup_preamble, sizeof(pn532_wakeup_preamble), 0);
  CHIP_DATA(pnd)->power_mode = NORMAL; // PN532 should now be awake
  sleep(4); //here
  return res;
}

now the board should have enough time to wakeup.. :)
i tested it and it is working.

but there is a bigger problem: i want "make install" and then "nfc-list", but 
then i can't notice a 4 sec sleep in the wakeup function. have you an idea?

Original comment by tobiasfu...@gmail.com on 16 Feb 2014 at 2:31

GoogleCodeExporter commented 9 years ago
Hi Tobias,

I will try your solution as soon as posible, i remember trying increasing the 
delay time but i will try again with your modifications.

Meanwhile, are you using the nfc-list global command or the nfc-list in the 
directory where you compiled the library? If the latter works but the first one 
not, that's posibly because you have two different versions of the library in 
your SO. I ended up deleting all the libnfc.so of my system and then building 
de libnfc rc1.

Let me know if that helps you.

Original comment by Christia...@gmail.com on 16 Feb 2014 at 6:06

GoogleCodeExporter commented 9 years ago
Hi,

Yeah it is the only change i made in source and its in another file as the old 
patch will patch. So not only increasing the delay. ;) I would be very happy if 
you will test it, because i want to write an article about that and it would be 
very useful, if your board would working with it, too :)

Ah OK, i will test that, thanks for this nice idea. If that works i will write 
again.

Original comment by tobiasfu...@gmail.com on 17 Feb 2014 at 5:11

GoogleCodeExporter commented 9 years ago
I over read some of the question. The local command goes right everytime, the 
global never.

Original comment by tobiasfu...@gmail.com on 17 Feb 2014 at 5:14

GoogleCodeExporter commented 9 years ago
Hello Tobias,

I tried your patch, it works perfect. Now i can use the lastest mfoc too (i 
made some nasty things to make it work with de old libnfc lib).

Thank you for taking the time to submit the fix :) I wish the authors update de 
patch to include it.

Feel free to contact me by email if you need more information of my board for 
your article.

Original comment by Christia...@gmail.com on 23 Feb 2014 at 7:11

GoogleCodeExporter commented 9 years ago
After removing all libnfc files an reinstalling it, everything runs right. 
Thanks for help :)

Here is my little instruction to get a pn532 board working with arduino and 
libnfc: nfc-tools.org/index.php?title=Libnfc:Arduino

Maybe you have some tips or something i should add.

Tobi

Original comment by tobiasfu...@gmail.com on 6 Mar 2014 at 5:50