Skip to content

Latest commit

 

History

History
68 lines (50 loc) · 4.14 KB

File metadata and controls

68 lines (50 loc) · 4.14 KB
page_type urlFragment languages products description
sample
nfc-iot
csharp
windows
Learn how use NFC on Windows 10 IoT Core.

Near Field Communication

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.

Prerequisites

In order to build and test this sample, you will need the following:

Set up a Raspberry Pi

  1. Before powering on your Raspberry Pi, assemble the NXP Explore-NFC kit, and attach to the Rasberry Pi.
  2. Set up your Raspberry Pi using the instructions here.

Build the ACPI Table.

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.

  1. Open a VS2015 x64 Native Tools Command Prompt
  2. Within the command prompt change directory to the NFCOnIoT sample.
  3. 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.
  4. This command will have generated a file called ACPITABL.dat which will be copied to your pi in the next section.
  5. You can type start . to open an explore window here, which you will use in the next step.

Setup the NFC Hardware

  1. In the IoT Dashboard, find your Raspberry Pi, then right click and select Open Network Share, Enter credentials if prompted.
  2. Once the network share opens, navigate to windows\system32.
  3. 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.
  4. On the network share, navigate to c:\data.
  5. From the Explorer Window which contains the ACPITabl.dat, there is also a file pn71x0.inf. Copy this to c:\data on the network share.
  6. Use SSH or Powershell to connect to your device.
  7. Change directory to c:\data in the connected session.
  8. Run the command devcon dp_add pn71x0.inf.
  9. Run the command shutdown -r -t 0 to restart the Rasberry PI for the hardware changes to take effect.

Configure the NFC Service to start automatically

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

  1. Run sc config SEMgrSvc start=auto to set this service to autostart on boot.
  2. 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.

  1. Set-Service SEMgrSvc -StartupType "Automatic" to set this service to autostart on boot.
  2. Start-Service SEMgrSvc to start it for this session.

Running the NFC Sample

  1. In the Samples folder you downloaded from Github, open NFCForIoT.sln.
  2. Build and deploy the application to your Raspberry Pi.
  3. Use the NTAG21x of your choice to see information about it and optionally configure it.