Topic: [SOLVED] nfc-dep-initiator against a Nexus S

Hi everyone,

I've successfully compiled libnfc under Ubuntu 11.04 (virtualized in VMWare). I got an ASK LoGO and a Nexus S.
The nfc-list command works. Now I'm trying to use the ASK LoGO as initiator, using the nfc-dep-initiator example.
Such command stucks on:

Connected to NFC device: ASK / LoGO - PN533 v2.7 (0x07)
D.E.P. (212 kbps) target:
       NFCID3: 64  61  00  c8  08  86  e7  fe  ac  2b  
           BS: 00
           BR: 00
           TO: 0e
           PP: 32
General Bytes: 46  66  6d  01  01  10  03  02  00  01  04  01  96  
Sending: Hello World!

While the Android log says:

NFC JNI       Discovered P2P Initiator
NfcService    LLCP Activation message
NFC JNI       phLibNfc Llcp CheckLlcp() returned 0x00ff[NFCSTATUS FAILED]
NFC JNI       Failed to destroy semaphore (errno=0x00000010)

What about that? Is it a common behavior/open issue?

Thanks,

Roberto

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Hello,

You are mixing up DEP and LLCP. DEP is a standard (modulation and frame format) that is used by LLCP which is a "Logical Link Control Protocol".

So, if you try nfc-dep-initiator, a DEP connection will be opened and Android will handled it by LLCP stack but as nfc-dep-initiator does not provide any LLCP support, Android's LLCP stack will fail to raise up a LLC communication.

If you want to talk using LLCP, you have to use libnfc-llcp library:
http://code.google.com/p/nfc-tools/sour … ibnfc-llcp

I think it helps smile

Romuald Conty

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Hi Romuald,

thank you, you're really very kind and patient. I saw the word "initiator" and I thought it was something related to LLCP roll

apropos libnfc-llcp smile I've successfully compiled it on my Ubuntu 11.04, but how can I test if it works?
That is, there are examples of programs ready to test a connection with my Nexus S?

Cheers,

Roberto

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Hi soulpower

There is no test program (yet) for communicating with an Android phone.  However, there is some WIP in the tools directory that waits for some LLCP communication.

Here is what I get with my modified copy of the code:

% ./tools/llcp-test-server/llcp-test-server --mode target
[stdout] TRACE    libnfc-llcp.llc.link - service 0x80100d140 bound to SAP 1
[stdout] TRACE    libnfc-llcp.llc.link - service 0x80100d1a0 bound to SAP 16
[stdout] TRACE    libnfc-llcp.llc.link - service 0x80100d200 bound to SAP 17
[stdout] INFO     libnfc-llcp.mac.link - (SCM Micro / SCL3711-NFC&RW - PN533 v2.7 (0x07)) Attempting to activate LLCP Link as target (blocking)
[stdout] INFO     libnfc-llcp.mac.link - (SCM Micro / SCL3711-NFC&RW - PN533 v2.7 (0x07)) LLCP Link activated (target)
[stdout] TRACE    libnfc-llcp.llc.link - llc_link_configure (0x80101ec00, 0x7fffffffd994, 10)
[stdout] DEBUG    libnfc-llcp.llc.link - Version: 1.0 (remote)
[stdout] DEBUG    libnfc-llcp.llc.link - Version: 1.0 (agreed)
[stdout] DEBUG    libnfc-llcp.llc.link - WKS: 0x0001
[stdout] DEBUG    libnfc-llcp.llc.link - LTO: 1500 ms (0x96)
[stdout] DEBUG    libnfc-llcp.llc.link - mq_open (/libnfc-llcp-83216-0x80101ec00-up)
[stdout] DEBUG    libnfc-llcp.llc.link - mq_open (/libnfc-llcp-83216-0x80101ec00-down)
[stdout] INFO     libnfc-llcp.llc.link - LLC Link started successfully
[stdout] INFO     libnfc-llcp.llc.llc - (0x80100ae40) Link activated
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) mq_receive+
[stdout] TRACE    libnfc-llcp.mac.link - Waiting for MAC Link deactivation
[stdout] TRACE    libnfc-llcp.mac.link - Received 19 bytes
[stdout] TRACE    libnfc-llcp.mac.link - Received 19 bytes
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) Received 19 bytes
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) Connect PDU
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) Spawning Data Link Connection [33 -> 1]
[stdout] TRACE    libnfc-llcp.llc.link - Searching SAP for service 'com.android.npp'
[stdout] INFO     libnfc-llcp.llc.link - Service 'com.android.npp' not available
[stdout] ERROR    libnfc-llcp.llc.llc - (0x80100ae40) Cannot establish Data Link Connection [33 -> 1] (reason = ffbfeeb3)
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) mq_send+
[stdout] TRACE    libnfc-llcp.mac.link - Sending 3 bytes
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) Sent 2 bytes
[stdout] TRACE    libnfc-llcp.llc.llc - (0x80100ae40) mq_receive+
[stdout] TRACE    libnfc-llcp.mac.link - Sending 3 bytes
[stdout] FATAL    libnfc-llcp.mac.link - MAC Level error on PDU reception
[stdout] WARN     libnfc-llcp.mac.link - pdu_receive returned -1
[stdout] INFO     libnfc-llcp.mac.link - MAC Committing suicide?!
[stdout] TRACE    libnfc-llcp.mac.link - MAC Link deactivated
[stdout] CRIT     libnfc-llcp.llc.link - Deactivating a LLC Link with a MAC link
[stdout] INFO     libnfc-llcp.mac.link - MAC Link deactivation requested
[stdout] INFO     libnfc-llcp.mac.link - Drain mode
[stdout] FATAL    libnfc-llcp.mac.link - MAC Level error on PDU reception
[stdout] WARN     libnfc-llcp.mac.link - pdu_receive returned -1 (drain)
[stdout] INFO     libnfc-llcp.mac.link - MAC Link deactivated
[stdout] FATAL    libnfc-llcp.llc.link - Deactivating LLC Link
[stdout] INFO     libnfc-llcp.llc.link - Freeing service 17
[stdout] INFO     libnfc-llcp.llc.link - Freeing service 16
[stdout] INFO     libnfc-llcp.llc.link - Freeing service 1

You need to build the library with log4c and use proper configuration (see the tests directory) for verbose output.

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Thank you Romain, I'll test it soon with my configuration setup.
Hope I can be of help.
Roberto

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Hello,

Even I am trying to use llcp-test-server to atleast initiate a P2P connection with the Nexus S.
I am using an ARYGON (PN532) desktop reader as target.

I have compiled llcp with log4c and picked up the configuration from tests. I point LOG4C_RCPATH to this new file.
I then run llcp-test-server --mode target.

However, the Nexus S always detects the Reader as a tag! and I see no message whatsoever as log output from llcp-test-server.

What am I doing wrong?

Roberto,
Did you get it running?

Cheers,
Earlence

Re: [SOLVED] nfc-dep-initiator against a Nexus S

earlenceferns wrote:

guration from tests. I point LOG4C_RCPATH to this new file.

I guess you should point this variable to the directory that contains the log4crc file ;-)

Re: [SOLVED] nfc-dep-initiator against a Nexus S

earlence@earlence-Satellite-L650:~/nfcwork/libnfc-llcp/tools/llcp-test-server$ ./llcp-test-server --mode target
[stderr] 20110909 09:58:05.000 TRACE    libnfc-llcp.llc.link- service 0x92a9eb0 bound to SAP 1
[stderr] 20110909 09:58:05.000 TRACE    libnfc-llcp.llc.link- service 0x92aa008 bound to SAP 16
[stderr] 20110909 09:58:05.000 TRACE    libnfc-llcp.llc.link- service 0x92aa038 bound to SAP 17
[stderr] 20110909 09:58:05.000 INFO     libnfc-llcp.mac.link- (ARYGON 00V6.5 (/dev/ttyUSB1) - PN532 v1.6 (0x07)) Attempting to activate LLCP Link as target (blocking)

That is my output. It gets stuck at attempting to activate link.
The Nexus S has an app running with NDEF foreground push enabled. It however, detects the ARYGON device as a tag!
I'm not sure whats happening here or how to debug it.
-Earlence

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Well I have not yet player wih the Nexus, I just wanted to see when I "share my tag" if some LLCP communication occurred and it did.  I guess some example that actually do read what the nexus shares would be cool :-)

If the application does not activate the LLC Link, maybe it uses the NFC component directly without LLC Layer (you can send NDEF data without NFC after all) ?

Re: [SOLVED] nfc-dep-initiator against a Nexus S

Hello,

earlenceferns wrote:

The Nexus S has an app running with NDEF foreground push enabled. It however, detects the ARYGON device as a tag!

Are you sure your libnfc is the latestest svn version ?

Romuald Conty

Re: [SOLVED] nfc-dep-initiator against a Nexus S

the version of LibNFC is r891 - 1.4.2

Re: [SOLVED] nfc-dep-initiator against a Nexus S

earlenceferns wrote:

the version of LibNFC is r891 - 1.4.2

That's the point. The libnfc-llcp is a WIP library so it need the latest SVN revision.

Romuald Conty

Re: [SOLVED] nfc-dep-initiator against a Nexus S

going to try it with r1182 v1.5

-
Earlence

Re: [SOLVED] nfc-dep-initiator against a Nexus S

While here, you can also compile the libnfc with --enable-debug to see the data actually transferred :-)

Re: [SOLVED] nfc-dep-initiator against a Nexus S

yes...it works like a charm. Thanks!

I still have to orchestrate the API calls in the nexus S for continuous p2p transactions, the Android API is not really lending itself to real P2P work smile

-Earlence