Posted 2017-02-02 10:31:31 +0100

blogs->nordicers

# New NFC feature on nRF52 Series: Read/write capable Type 4 Tag NFC library in nRF5 SDK.

No tags

The nRF52832 and nRF52840 devices have a built-in NFC radio which can be used for exposing data as a dynamic NFC tag (a tag with configurable data). This can be used as a standard tag type for storing a web link or a text, to launch apps on smartphones and tablets as well as for simple and secure BLE pairing (read more here). All these features are provided by the Type 2 Tag library in the nRF5 SDK. Starting from version 12.2 of the nRF5 SDK, we expanded the NFC software to support even more features. The new Type 4 Tag library does not only allow faster communication and exposing more data in the tag, but also provides the write functionality. So you can write data to the tag with an NFC Reader/Writer such as a smartphone. Furthermore, NFC Type 4 Tag is used in many secure transactions systems, e.g., payment systems, transport ticketing systems etc. Thus, it opens up new markets for the nRF52 Series with its combined NFC and BLE functionallity

## Use case: Configuring a BLE device via NFC.

Writing data through the NFC can be used to easily configure a BLE device such as a beacon. Most beacons don’t have I/O capabilities (displays, buttons), and if there are many of them in the range, it is not that easy to configure their parameters – you would need to find the one and setup a BLE connection. So why not use NFC to configure your beacon by simply touching it? Additionally, this could be helpful for production configuration – there could be plenty of beacons on a production line and each of them needs its own configuration.

Let me try to explain how to do it. First you need to define what parameters you would like to send to your beacon: this could be name, UUID, specific advertising parameters etc. Then prepare your data for writing to the tag: you can try to develop your own app, that will encode the configuration data or use an existing app. Use custom “MIME Type” because the tag information is non-standard. The detailed format of the beacon configuration parameters to send over NFC is up to you. Additionally, if authentication is required you may use signing of the configuration data and verify them in the beacon application.

On the embedded side you will need to develop a BLE application, that will use the Type 4 Tag library in a writable mode. The data received from the smartphone will use the standard NFC format called NDEF. To get your configuration parameters out of the NDEF message use the NDEF parser libraries (message and record parsers) and your own parser to decode the payload according to the format you defined. Then store the received data using the “Flash Storage” module. Now your application can re-configure to use the new parameters. The SDK application “Experimental: Writable NDEF Message Example” can help you configure and use the Type 4 Tag library in a writable mode. As you can see, implementation of an NFC-configurable beacon is not very complex. And from a beacon user perspective, configuration through NFC can be a great simplification.

## Getting started with NFC Type 4 Tag using nRF5 SDK

As a first step, open the “Writable NDEF Message Example” (examples\nfc\experimental_writable_ndef_msg) – it will show you, how the Type 4 Tag library can be used for exposing initial data in the tag in a writable mode, so a reader/writer can overwrite it. The written data can be parsed using the following NDEF Message Parser (components\nfc\ndef\parser\message).

Once you have your configuration data you can use it and/or store it in a persistent storage e.g. on-board Flash memory using nrf_nvmc module (components\drivers_nrf\hal) or the Flash Storage module (components\libraries\fstorage) if you use a SoftDevice in your application.

Posted Feb. 5, 2017, 3:18 p.m.

I'll try that with my PCA10040 v1.1.1 soon.

Posted Feb. 5, 2017, 8:04 p.m.

:-)

Any feedback is welcome @Mango922

Posted Feb. 8, 2017, 8:02 p.m.

So I am clear, this is really only Android applicable because IOS still has NFC locked down extremely tight - correct?

Posted Feb. 8, 2017, 9:17 p.m.

@SRA yepp, you are correct. It is not supported on iOS :-(

## Recent blog posts

• ### nRF52840 long range demo

Posted 2017-02-14 12:46:03 by Ole Bauck
• ### Setup and Running the OpenMesh DFU on the nRF52 DK v2.0

Posted 2017-02-06 22:33:25 by martindavidb
• ### New NFC feature on nRF52 Series: Read/write capable Type 4 Tag NFC library in nRF5 SDK.

Posted 2017-02-02 10:31:31 by Pär H
• ### Simple Application-level Authentication

Posted 2017-01-30 12:34:01 by Daniel Veilleux
• ### WIZnet's BLE to TCP Gateway

Posted 2017-02-01 01:12:03 by Mason Lee

## Recent questions

• ### How Can I sniff GATT Service or Characteristic Attributes by PCA10031 (NRF51 Dongle)?

Posted 2017-02-25 08:33:42 by Daniel T. Lee
• ### After the host calls "sd_ble_gap_connect_cancel", the slave is not disconnected.

Posted 2017-02-25 05:56:16 by shuhe
• ### How to get device details of BLE devices seen by NRF52?

Posted 2017-02-25 04:37:49 by QDI
• ### GCC/Eclipse tutorial: make: The system cannot find the file specified

Posted 2017-02-25 01:53:35 by dkwill
• ### [Hardware] nRF52 - NFC antenna design

Posted 2017-02-24 23:31:41 by Konrad Traczyk