P2P NFC Communication Between Galaxy S3 and ACR122

I am working on a project that requires an NFC connection between an android phone and a PC. I use the Galaxy S3 as an Android phone and ACR122 as an NFC reader. I tried the applications in here and here .

I used a sample application that I found in android sdk to pass an NDEF message through NFC.

No matter how many times I tried, I could not establish a connection between the phone and the PC. The Android application works great because it can trigger an NDEF message through other phones, but when it comes to connecting to a PC, it doesn't work. While reading, the reader changes color from red to blinking green and orange when I touch the phone to the reader, but nothing else happens.

The ismb-npp-java application has a log output:

Get factory

Get terminals

Terminal Name: ACS ACR122 0

T = 1

Called rightProcedureTarget ..

[DEBUG] {sending [50 bytes]} 0xFF 0x00 0x00 0x00 0x2D 0xD4 0x8C 0x01 0x00 0x00 0x00 0x00 0x00 0x40 0x01 0xFE 0x0F 0xBB 0xBA 0xA6 0xC9 0x89 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xFF 0xFF 0x01 0xFE 0x0F 0xBB 0xBA 0xA6 0xC9 0x89 0x00 0x00 0x06 0x46 0x66 0x6D 0x01 0x01> 0x10 0x00

it.ismb.npp.IsmbNppException: data transfer problem

[DEBUG] {sending [7 bytes]} 0xFF 0x00 0x00 0x00 0x02 0xD4 0x86

[DEBUG] {sending [26 bytes]} 0xFF 0x00 0x00 0x00 0x15 0xD4 0x8E 0x05 0x20 0x06 0x0F 0x63> 0x6F 0x6D 0x2E 0x61 0x6E 0x64 0x72 0x6F 0x69 0x64 0x2E 0x6E 0x6E

at it.ismb.npp.IsmbNppConnection.transceive (IsmbNppConnection.java:281)

in it.ismb.npp.IsmbNppConnection.rightProcedureTarget (IsmbNppConnection.javahaps01)

at it.ismb.npp.SenderToPhone $ ThreadSender.run (SenderToPhone.java:90)

at it.ismb.npp.SenderToPhone $ InitatorTask.run (SenderToPhone.java:75)

in java.util.TimerThread.mainLoop (Unknown source)

in java.util.TimerThread.run (Unknown source)

it.ismb.npp.IsmbNppException: data transfer problem

at it.ismb.npp.IsmbNppConnection.transceive (IsmbNppConnection.java:281)

in it.ismb.npp.IsmbNppConnection.rightProcedureTarget (IsmbNppConnection.java:306)

at it.ismb.npp.SenderToPhone $ ThreadSender.run (SenderToPhone.java:90)

at it.ismb.npp.SenderToPhone $ InitatorTask.run (SenderToPhone.java:75)

in java.util.TimerThread.mainLoop (Unknown source)

in java.util.TimerThread.run (Unknown source)

Exception in thread "Timer-0" java.lang.IllegalStateException: Map deleted

at sun.security.smartcardio.CardImpl.checkState (Unknown source)

at sun.security.smartcardio.ChannelImpl.checkClosed (Unknown source)

at sun.security.smartcardio.ChannelImpl.transmit (Unknown source)

at it.ismb.npp.IsmbNppConnection.transceive (IsmbNppConnection.java:263)

at it.ismb.npp.IsmbNppConnection.rightProcedureTarget (IsmbNppConnection.javahaps17)

at it.ismb.npp.SenderToPhone $ ThreadSender.run (SenderToPhone.java:90)

at it.ismb.npp.SenderToPhone $ InitatorTask.run (SenderToPhone.java:75)

in java.util.TimerThread.mainLoop (Unknown source)

in java.util.TimerThread.run (Unknown source)

I used all the drivers that I could find (including the latest driver), but the problem persists.

May have a problem with the device? Or am I missing something here?

+4
source share
3 answers

What version of Android are you using? NPP only works in older versions of Android (suppose ICS).

For ICS and JellyBean, try using SNEP. The author of the project you are using has a version for SNEP:

http://code.google.com/p/ismb-snep-java/

0
source

try this to get NfcAdapter

nfcP2PAdapter = NfcAdapter.getDefaultAdapter (recentContext.getApplicationContext ());

// recentContext is activity (this)

It will work for you, it works for me

0
source

The error you reported refers to the transceiver method in NppConnection.java. I would suggest placing the phone on the reader first (let the reader LED turn green), and then run the application again. See if this works. If not, set a breakpoint in the transceiver method and check the values ​​of SW1 and SW2 (if the command is successful, you expect sw1 = 0x90 and sw2 = 0x00). In case of errors, you will get either sw2 not equal to 0x00, or sw1 = 0x63.

In my opinion, even if you are using a newer version of Android, and if snep is not supported by any of your devices, they will return to the nuclear power plant.

0
source

Source: https://habr.com/ru/post/1441477/


All Articles