Topic: send NDEF message to android using libnfc and llcp

Hi,
I am trying to communicate nfc module with Android mobile.
I used itead nfc module interface with rasberry pi.
And using libnfc1.7.1 and libllcp for communicate with mobile.

After run libllcp client example,
$ LIBNFC_LOG_LEVEL=3 ./examples/snep-client/snep-client
I get this error

"error libnfc.driver.pn532_spi Unable to wait for SPI data. (RX)
libllcp.mac.link Could not send 2 bytes"

Log:=

debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 01
debug libnfc.bus.spi TX: 03
debug libnfc.bus.spi RX: 00 00 ff 20
debug libnfc.bus.spi RX: e0
debug libnfc.bus.spi TX: 03
debug libnfc.bus.spi RX: d5
debug libnfc.bus.spi TX: 03
debug libnfc.bus.spi RX: 57
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 03
debug libnfc.bus.spi RX: 01 df 0b 63 89 dc 35 50 ec 59 a2 00 00 00 0e 32 46 66 6d 01 01 11 03 02 00 13 04 01 96
debug libnfc.bus.spi RX: 96
debug libnfc.bus.spi TX: 03
debug libnfc.bus.spi RX: 00
libllcp.mac.link (pn532_spi:/dev/spidev0.0) nfc_initiator_poll_dep_target() succeeded
libllcp.mac.link (pn532_spi:/dev/spidev0.0) LLCP Link activated (initiator)
libllcp.llc.link llc_link_configure (0x143d80, (nil), 0)
libllcp.llc.link mq_open (/libllcp-2532-0x143d80-up)
libllcp.llc.link mq_open (/libllcp-2532-0x143d80-down)
libllcp.llc.link LLC Link started successfully
libllcp.mac.link Sending 2 bytes
libllcp.mac.link LTOs: 1000 ms (local), 100 ms (remote)
debug libnfc.chip.pn53x InDataExchange
debug libnfc.chip.pn53x Timeout value: 1100libllcp.llc.llc (0xb6d16470) Link activated
libllcp.llc.llc (0xb6d16470) mq_receive+

debug libnfc.bus.spi TX: 01 00 00 ff 05 fb d4 40 01 00 00 eb
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 01
debug libnfc.bus.spi TX: 03
debug libnfc.bus.spi RX: 00 00 ff 00 ff 00
debug libnfc.chip.pn53x PN53x ACKed
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00

***** AFTER SOME SAME LOG********

debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
debug libnfc.bus.spi TX: 02
debug libnfc.bus.spi RX: 00
error libnfc.driver.pn532_spi Unable to wait for SPI data. (RX)
libllcp.mac.link Could not send 2 bytes

Questions:
I used pn532(itead nfc) module to communicate with android 4.3 (samsung S3).
Is there any problem in libnfc which cause error?
Is 1.7.1 libnfc version is right to use with libllcp library and snep protocol to send my NDEF massage to android?

Please comment your view about this error log, May it help me to solve error.

Thank you

Re: send NDEF message to android using libnfc and llcp

Hi,

Maybe you could try to increase timeout value.

Romuald Conty

Re: send NDEF message to android using libnfc and llcp

Hi,
would you like teach me how to use the libllcp ,i have tried more times ,but it always reply "Cannont found nfc device !".however I can't find where is the problem.As same as you used libnfc-1.7.1 and libllcp connect with Android phone ,help me thanks!

Re: send NDEF message to android using libnfc and llcp

Why do we need libllcp?

libnfc-1.7.1 has nfc-dep-initiator and nfc-dep-target, how to use it? Can we send message or data from pn532 attached to some controller (controller) to another pn532 (inside android phone) ? Do we have to do some coding first inside the android? or is there any app that is already provided for p2p DEP for android and we can use it with libnfc?

Re: send NDEF message to android using libnfc and llcp

Romuald Conty

Re: send NDEF message to android using libnfc and llcp

I am sorry I still don't get it about this LLCP. By using pn532 user manual document, I can send NDEF message (or any data in HEX) into every sector address that I want on an NFC Mifare Classic 4K card. I just need to send some commands to pn532, put the card near pn532 and I can write or read  the card. Now, I want to send a data (let's say a simple NDEF message) from pn532 (connected to a linux computer) and I want my Android Smart Phone (Nexus S) receive my data. How can I do that? Do I need to create a custom application on my Android? Do I need to download some application on Android? Do I need to install libllcp on my linux computer? I have followed some command to create p2p connection to other pn532. My Android reacted to the other pn532 but I don't know how to send a data between the two of them. Can you help me? or Can you give me a link or a book or a notes that shows how to do it?