Reputation: 21
I want to send information from an Arduino to a phone via NFC.
To do this I have a PN532 module. The way I want to send information is to use the module to emulate an NFC tag and read the message from the phone. The reason I don’t want to use a real NFC card is due to the memory limitations. Most of them have near 800 bytes of memory and the ones with more memory are expensive. In case I emulate a card with PN532 module, will I still have some memory limitation?
I founded this in the documentation:
What I saw that was important was APDU bytes limitations. I’m not really an expert in NFC and I don’t know if this would affect me in the emulated card memory.
The information that I wanted to have is a JSON in plain text. I think that is supported in NDEF messages and so iPhones would be able to read it. The JSON could have up to 2500 characters or bytes and would change a lot of times each day so the rewrite part of the physical card is a problem as well.
Upvotes: 1
Views: 870
Reputation: 10232
My understanding is that ISO 14443-4 is a transmission protocol https://webstore.iec.ch/preview/info_isoiec14443-4%7Bed4.0%7Den.pdf and therefore is a limit of how much that you can send/receive in one Command. This does not limit you from using multiple commands to send and receive to emulate more memory.
So really what should happen a device would issue iso 7816-4 commands to the emulated card over ISO 14443-4.
A device when reading should obey what has been identified as the max transceive length which the device says it should supports (in your case should be 256 Bytes for Short APDU command) and thus it should read multiple 256 Byte chunks to read the whole file (memory)
See the ISO 7816-4 read binary
command https://cardwerk.com/smart-card-standard-iso7816-4-section-6-basic-interindustry-commands/#chap6_1 it has offset and length parameters
So for larger data basically your HCE response code on the Arduino should get passed from the PN532 a "read binary of 0 to 255 bytes" command for which you would respond with the first 256 bytes of the JSON data.
Then a second "read binary of 256 to 512 bytes" would be issued by the device, etc until all data you want to return has been returned.
Therefore it is reading the emulated file (memory) is chunks of the max size that can be transmitted by the short APDU (256k) supported by this device.
Note I've not done any coding with this just have knowledge of the standards.
Note you can get cards with up to 32K storage, yes they cost more but a 4Kbyte Desfire card is only about 150% the price of an Ntag216 with 888byte memory.
Upvotes: 1