baternest / ismb-npp-java

Automatically exported from code.google.com/p/ismb-npp-java
0 stars 0 forks source link

Exception on start up in NppFromReaderToPhone #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hey,

I just managed to configure the NFC device properly and run the Java code 
example provided in NppFromReaderToPhone.zip. After running the code as an Java 
application I receive each time the same error on different platforms/operating 
systems. Furthermore the error code is not understandable for me, i.e., 0x63 
0x00 - Generic Error.

Error-Log (w/o an nfc device):

Get factory
Get terminals
Terminal name: ACS ACR122 0
T=0
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 
[DEBUG] {receiving [2 bytes]} 0x63 0x00 
Exception in thread "Timer-0" java.lang.ArrayIndexOutOfBoundsException
    at it.ismb.npp.Util.appendToByteArray(Util.java:100)
    at it.ismb.npp.Util.subByteArray(Util.java:121)
    at it.ismb.npp.IsmbNppConnection.transceive(IsmbNppConnection.java:279)
    at it.ismb.npp.IsmbNppConnection.rightProcedureTarget(IsmbNppConnection.java:301)
    at it.ismb.npp.SenderToPhone$ThreadSender.run(SenderToPhone.java:90)
    at it.ismb.npp.SenderToPhone$InitiatorTask.run(SenderToPhone.java:75)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)

Runtime Environments:

(1) Windows XP SP3 in a VM
(2) Ubuntu 11.04 in a VM
(3) NFC Reader (touchatag/ACR122U added w/ USB passthrough option)

Output of nfc-list w/ ACR122U and a mifare card:

~/nfc/libnfc-1.5.0/examples$ ./nfc-list
/home/romank/nfc/libnfc-1.5.0/examples/.libs/lt-nfc-list use libnfc 1.5.0 
(r1019)
lt-nfc-list: ERROR: Unable to read ACK
pn53x_check_communication: Operation timed-out
lt-nfc-list: ERROR: Unable to read ACK
pn53x_check_communication: Operation timed-out
Connected to NFC device: ACS ACR122U 00 00 / ACR122U103 - PN532 v1.6 (0x07)
1 ISO14443A passive target(s) found:
    ATQA (SENS_RES): 00  04  
       UID (NFCID1): ae  e0  4b  9a  
      SAK (SEL_RES): 08

Output of pcsc_scan:

pcsc_scan
PC/SC device scanner
V 1.4.17 (c) 2001-2009, Ludovic Rousseau <ludovic.rousseau@free.fr>
Compiled with PC/SC lite version: 1.5.5
Scanning present readers...
0: ACS ACR122U 00 00

Fri Oct  7 16:28:10 2011
 Reader 0: ACS ACR122U 00 00
  Card state: Card inserted, 
  ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00

ATR: 3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
+ TS = 3B --> Direct Convention
+ T0 = BE, Y(1): 1011, K: 14 (historical bytes)
  TA(1) = 95 --> Fi=512, Di=16, 32 cycles/ETU
    125000 bits/s at 4 MHz, fMax for Fi = 5 MHz => 156250 bits/s
  TB(1) = 00 --> VPP is not electrically connected
  TD(1) = 00 --> Y(i+1) = 0000, Protocol T = 0 
-----
+ Historical bytes: 41 03 00 00 00 00 00 00 00 00 00 02 90 00
  Category indicator byte: 41 (proprietary format)

Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
3B BE 95 00 00 41 03 00 00 00 00 00 00 00 00 00 02 90 00
    touchatag SAM card

Original issue reported on code.google.com by roman.ko...@gmail.com on 7 Oct 2011 at 2:31

GoogleCodeExporter commented 9 years ago
Hi,

I get the same error :(. Every time I try the NppFromReaderToPhone, I get the 
""[DEBUG] {receiving [2 bytes]} 0x63 0x00 "". I´m using an ACR122 too...

Any solution?

Thanks in advance!

Original comment by recioma...@gmail.com on 13 Oct 2011 at 7:11

GoogleCodeExporter commented 9 years ago
@Developer
Could you post your version of the firmware (ACR122)? Maybe the issue is 
related to a "bug", could be also a feature ;), inside a certain firmware 
version.

Cheers,
Roman

Original comment by roman.ko...@gmail.com on 24 Oct 2011 at 8:00

GoogleCodeExporter commented 9 years ago
What would be the best way to publish the fix?

The solution for this issue is really trivial. The power of the antenna is off 
;) Before starting to transmit any kind of APDU towards the contactless 
interface, one has to switch on the power of the antenna according to the spec 
(http://www.nfc-reader.com/NFC-smart-card-reader/ACR122-API-Manual/API_ACR122.pd
f). Otherwise the answer will be 0x63 0x00.

Log:
Get factory
Get terminals
Terminal name: ACS ACR122U 00 00
T=0
Called rightProcedureTarget..
[DEBUG] {sending   [9 bytes]} 0xFF 0x00 0x00 0x00 0x04 0xD4 0x32 0x01 0x01 
[DEBUG] {receiving [4 bytes]} 0xD5 0x33 0x90 0x00 
[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 
[DEBUG] {receiving [35 bytes]} 0xD5 0x8D 0x04 0x1E 0xD4 0x00 0xF9 0x2A 0x2A 
0xAB 0xBB 0x12 0xCE 0x64 0x29 0xC9 0x00 0x00 0x00 0x32 0x46 0x66 0x6D 0x01 0x01 
0x10 0x03 0x02 0x00 0x01 0x04 0x01 0x96 0x90 0x00 
[DEBUG] {sending   [7 bytes]} 0xFF 0x00 0x00 0x00 0x02 0xD4 0x86 
[DEBUG] {receiving [7 bytes]} 0xD5 0x87 0x00 0x00 0x00 0x90 0x00 
[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 0x70 
0x70 
[DEBUG] {receiving [5 bytes]} 0xD5 0x8F 0x00 0x90 0x00 
[DEBUG] {sending   [7 bytes]} 0xFF 0x00 0x00 0x00 0x02 0xD4 0x86 
[DEBUG] {receiving [11 bytes]} 0xD5 0x87 0x00 0x81 0x90 0x02 0x02 0x00 0x78 
0x90 0x00 
[DEBUG] {sending   [77 bytes]} 0xFF 0x00 0x00 0x00 0x48 0xD4 0x8E 0x43 0x20 
0x00 0x01 0x00 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x39 0xD1 0x01 0x35 0x54 0x02 
0x65 0x6E 0x4E 0x50 0x50 0x20 0x74 0x65 0x73 0x74 0x20 0x63 0x6F 0x6D 0x6D 0x75 
0x6E 0x69 0x63 0x61 0x74 0x69 0x6F 0x6E 0x20 0x62 0x65 0x74 0x77 0x65 0x65 0x6E 
0x20 0x4E 0x45 0x58 0x55 0x53 0x2D 0x53 0x20 0x61 0x6E 0x64 0x20 0x41 0x43 0x52 
0x2D 0x31 0x32 0x32 
[DEBUG] {receiving [5 bytes]} 0xD5 0x8F 0x00 0x90 0x00 
Finished

Original comment by roman.ko...@gmail.com on 25 Oct 2011 at 4:17

GoogleCodeExporter commented 9 years ago
Did anyone find a solution to this issue? 

Original comment by jeff.tok...@gmail.com on 15 Jul 2012 at 10:29

GoogleCodeExporter commented 9 years ago
I have also this problem. ...who can give a right solution???

Original comment by imleihu...@googlemail.com on 14 Feb 2013 at 11:40

GoogleCodeExporter commented 9 years ago
Os jodéis todos

Original comment by avillapa...@gmail.com on 15 Oct 2013 at 4:11

GoogleCodeExporter commented 9 years ago
The solution is to transmit the following APDU before transmitting any APDU 
that is dedicated for the NFC application layer of the smartphone.

The APDU is: 0xFF 0x00 0x00 0x00 0x04 0xD4 0x32 0x01 0x01

CLA: 0xFF, INS: 0x00, P1:0x00, P2:0x00, payload's length: 0x04, payload: 0xD4, 
0x32, 0x01, 0x01

Log:

[DEBUG] {sending   [9 bytes]} 0xFF 0x00 0x00 0x00 0x04 0xD4 0x32 0x01 0x01 
[DEBUG] {receiving [4 bytes]} 0xD5 0x33 0x90 0x00 

Cheers,
Roman

Original comment by roman.ko...@gmail.com on 15 Oct 2013 at 4:42