page_type | urlFragment | languages | products | description | ||
---|---|---|---|---|---|---|
sample |
nfc-iot |
|
|
Learn how use NFC on Windows 10 IoT Core. |
Near Field Communication allows a device to send small pieces of data when in close proxmimity to other NFC devices. NFC hardware is required for this communication. On Windows 10 IoT Core, you can communicate with the hardware manually by using the GPIO, I2C or SPI APIs, or you can use the SmartCard APIs if a driver is associated with the hardware.
In this sample, we will demonstrate how to set up the NXP NFC SBC Kit and how to communicate with an NXP NTAG21x.
In order to build and test this sample, you will need the following:
- Visual Studio 2015 Update 3.
- NXP Explore-NFC Kit.
- BullsEye NFC NTAG216 Sticker or xNTi NFC Implant Kit
- Before powering on your Raspberry Pi, assemble the NXP Explore-NFC kit, and attach to the Rasberry Pi.
- Set up your Raspberry Pi using the instructions here.
In order to assocate the NXP Explore-NFC hardware with the driver, resources need to be allocated for it in the ACPI Table. Included in the sample is a file pn71x0.asl
, which
needs to be compiled in order to apply it to your Raspberry PI.
- Open a
VS2015 x64 Native Tools Command Prompt
- Within the command prompt change directory to the NFCOnIoT sample.
- Within the command prompt run
"C:\Program Files (x86)\Windows Kits\10\Tools\x64\ACPIVerify\asl.exe" pn71x0.asl
. NOTE: you will get a warning; this is benign. - This command will have generated a file called
ACPITABL.dat
which will be copied to your pi in the next section. - You can type
start .
to open an explore window here, which you will use in the next step.
- In the IoT Dashboard, find your Raspberry Pi, then right click and select
Open Network Share
, Enter credentials if prompted. - Once the network share opens, navigate to
windows\system32
. - Copy the
ACPITABL.dat
from the explorer window you opened in the previous section, and copy it to the folder in on the network share you opened in the previous step. - On the network share, navigate to
c:\data
. - From the Explorer Window which contains the
ACPITabl.dat
, there is also a filepn71x0.inf
. Copy this toc:\data
on the network share. - Use SSH or Powershell to connect to your device.
- Change directory to
c:\data
in the connected session. - Run the command
devcon dp_add pn71x0.inf
. - Run the command
shutdown -r -t 0
to restart the Rasberry PI for the hardware changes to take effect.
In order to minimize the number of resources used by IoT Core, the NFC Service does not start by default. To make it start automatically, use SSH to connect to the device and then
- Run
sc config SEMgrSvc start=auto
to set this service to autostart on boot. - Run
sc start SEMgrSvc
to start it for this session.
If you prefer Powershell to connect to your device, run the following commands in PowerShell.
Set-Service SEMgrSvc -StartupType "Automatic"
to set this service to autostart on boot.Start-Service SEMgrSvc
to start it for this session.
- In the Samples folder you downloaded from Github, open NFCForIoT.sln.
- Build and deploy the application to your Raspberry Pi.
- Use the NTAG21x of your choice to see information about it and optionally configure it.