Search code examples
nfcapduacr122large-data

NFC : APDU and SNEP length limitation


I'm working on a project in order to exchange large data from PC to Android device throught NFC. I'm using ACR122.

The following is a general exemple of data sent :

// ADPU
FF FF 00 00 00 nn   // CLA, INS, P1, P2, Le, Lc
D4 40               // TFI, PD0
01                  // (Mi), Target

// LLCP
13 20               // DSAP, PTYPE, SSAP
00                  // Sequence
D4 40               // TFI, PD0

// SNEP
10 02               // Protocol Version, Action
nn nn nn nn         // Total SNEP Length

// NDEF Header
A2                  // First byte (MB = 1, ME = 0, Cf = 1, SR = 0, Il, TNF)
22                  // Type length
mm mm mm mm         // Payload length

// NDEF Content
61.....65           // Type (34 bytes in that case)
01.....01           // Payload (mm mm mm mm bytes)

Here, I send a Record (not short record).So the NDEF header allows to enter a 4 bytes payload length.
Finaly, my question is how could we send a such large payload regarding the 1 byte APDU Lc ?
If this limitation is only due to the pn532 chip or PS/SC, what alternative hardware would you suggest ?

Thank you for any clarification

EDIT :
I found what I was looking for here :
Sending Extended APDU to Javacard
It's a hardware problem, PN532 don't support Extended APDU.


Solution

  • As you've already found out the ACR122 does not support extended APDU due to a limitation of the PN532 chip.

    However, there is no need to pack the entire SNEP transfer into a single APDU. You can split the payload into multiple smaller frames and send them one after another. It's only important that the NDEF header gets transmitted as a whole in the first frame.