This project is read-only.
Project Description
Example code and library for raw communication to NFC tags with Windows Phone 8.1, but requires a device with support (Lumia 830 & 73x)

NOTE: This code will work only on a Windows Phone running 8.1 or higher, and with an NFC driver that supports smart card reader mode such as the NXP PN547 which is available on the Lumia 730 and Lumia 830 (it will NOT work on a Lumia 930 or any existing hardware, even after updating to 8.1). See inside the MainPage.GetDevices() function for how to detect at runtime whether a device supports this functionality.

A new feature in Windows Phone 8.1 (on specific new hardware devices) is to be able to directly send raw commands to external plastic NFC cards, previously the phone could only read/write NDEF messages to NDEF-formatted tags but now you can talk to things like transit passes etc. For NXP PN547-based devices NFC cards such as MIFARE Classic/Ultralight/DESfire, ISO7816-4/APDU-based cards like JCOP, Jewel are supported as well as some limited support for ISO15693 and Felica. This project contains sample code only for MIFARE Classic/Ultralight/DESfire and Felica, but can be easily extended to support the others.

The Windows.Devices.SmartCards.SmartCardReader WinRT API lets you send raw APDU commands and get responses (similar to the WinSCard Win32 APIs on desktop), but for cards that are not APDU-based (eg MIFARE Classic/Ultralight, Felica, Jewel, ISO15693 etc) we follow the PC/SC standards whereby you construct an APDU containing the data needed for the command you want and the NFC driver will convert that to the appropriate native command and send to the card. Also, in order to identify the type of non-ISO7816-4/APDU card present the ATR (answer to reset) returned by the SmartCard object is encoded according to the PC/SC specifications. The PcscSdk project source code contains libraries that will encode/decode the PC/SC-based APDUs/ATRs necessary to talk to these contactless NFC plastic cards, and there is a sample phone app that demonstrates the usage.

For details on the PC/SC APDU encoding of commands to non-APDU-based contactless cards please refer to section 3.1.3 in the PC/SC specification here: as well as the supplemental documents here: and here:

The following is a partial list of commands which are supported by the NXP PN547 driver but this sample code has not yet implemented, please do contribute back to the project if you implement them

ISO15693 Family
Command CLA INS P1 P2 Le
WRITE 0xFF 0xD6 Block Number 0x00 0x4

Jewel Family
Command CLA INS P1 P2 Le
WRITE1-E 0xFF 0xD6 Block Number Block Offset 0x01
WRITE8-E 0xFF 0xD6 Block Number 0x00 0x08

Jewel Family
Command CLA INS P1 P2 Le
READ ALL 0xFF 0xB0 0x00 0x00 0x00
RID 0xFF 0xB0 0x00 0x00 0x06
READ 0xFF 0xB0 Block No Block Offset 0x01
READ 8 0xFF 0xB0 Block No 0x00 0x08
READ SEG 0xFF 0xB0 0x00 Segment Addr 0x80

MIFARE Standard increment/decrement etc, see section in

Last edited Sep 15, 2014 at 11:37 PM by Alex288, version 7