Hi!
I'm current working on a LLCP/NPP implementation for nfctools for java. It is a real pain to work with nexus s (android 2.3.4). It constantly hangs in all phases of the protocol. After that it is unable to reset itself so I have to deactivate and activate the NFC option in the settings or even reboot the phone.
Yesterday I was able to exchange a NDEF message from the ForegroundNdefPush demo app. I wanted to post my TAMA messages exchange log here, but my editor crashed
Today the app doesn’t work anymore…
I will keep trying and hopefully come back with an update. If you are working on LLCP/NPP please help share your findings to make the communication more stable. Here is what I found out so far:
- The nexus S is in a constant NDEF push state. As soon as the display is on it will connect to a target and initiate a NFCIP connection.
- If there is no NDEF message to be sent it will start to exchange SYMMETRY LLCP protocol data units (PDU). This can go on forever (I assume).
- If you have an NDEF message on the phone, it will send a CONNECT PDU to the service “com.android.npp”, and expect a CONNECT_COMPLETE answer. Then it will send an INFORMATION PDU with the NDEF message which is encapsulated in the NPP format. I answered this with a RECEIVE_READY PDU. After that it will send a DISCONNECT PDU which I answered with a DISCONNECT_MODE PDU.
- I haven’t successfully send a message which is longer than the 128 byte (maximum exchange unit) so I don’t know how the messages will be split, but this is the moment where my software stopped working yesterday.
Here is some of the stuff that still works:
I’m sending the following data in the TAMA tgInitAsTarget
0000FF27D9 D48C 00 000000000040 01FE01020000000001000000000000000000 01010100000000000000 00 00 5A00
The phone answers with:
0000FF21DF D58D 22 1ED40001FE01020000000000000000003246666D01011003020001040196 8A00
Interesting here is the mode byte 0x22: it says, baudrate 424kbps, DEP no, Felica Mode.
Note also the 46666D LLCP header with the params behind it.
After that I send my general bytes also with the LLCP header and version param:
0000FF08F8 D492 46666D010110 6F00
Then I send a tgGetData:
And receive a CONNECT PDU:
0000FF16EA D587 00 0521060F636F6D2E616E64726F69642E6E7070 9F00
My answer is CONNECT_COMPLETE PDU via tgSetData:
0000FF04FC D48E 8581 9800
After that I’m stuck right now, because the next tgGetData is answered with
Here you see the 0x13 error code: DEP Protocol/Mifare/ISO-14443-4: The data format does not match the specification
No idea why it is that. Must investigate. Please help if you notice anything strange here.