Mistake on this page?
Report an issue in GitHub or email us

NFC

NFC stands for Near-Field Communication and is a short-range radio technology. You can use it to enable use cases such as contactless payments, access control and device pairing.

N Mark

You can find more details on NFC about the NFC Forum's website.

NFC support in Mbed OS

Historically, NFC encompasses multiple protocols. NFC support in Mbed OS is based on the specifications the NFC Forum publishes.

NFC offers three modes:

  1. NFC card emulation.
  2. NFC reader or writer.
  3. NFC peer to peer.

Mbed OS supports the card emulation mode, either through the use of a controller or NFC EEPROM.

NFC support is available for the NXP PN512 transceiver. In terms of NFC EEPROMs, a driver for the ST M24SR EEPROM series is available - we also provide a porting guide to add support for other NFC EEPROMs.

We also provide APIs to decode and encode NDEF messages. A NDEF message is a standardized encoding that most NFC devices, such as Android and iOS smartphones, can understand.

An NFC EEPROM can read from and write to a NDEF message. A NFC initiator can access the message through the NFC interface the EEPROM exposes.

The NFC Forum defines 5 Tag specifications, which define how to transmit and receive NDEF messages on top of various NFC technologies.

When using a controller, the Mbed OS NFC Framework can implement the Type 4 Tag platform. This means that the initiator can generate NDEF messages dynamically before each read and parse it after each write.

NFC controllers and NFC EEPROMs

These components address different use cases, and you need to consider two factors: cost and functionality.

Most NFC controllers implement many modes of NFC and offer flexibility; however, they are typically more expensive than NFC EEPROMs.

NFC controllers typically support a large subset (if not all) of NFC Forum functionality, can act as either initiators or targets and are driven by an external stack. In Mbed OS, this means that you can generate NDEF messages "on demand" when the initiator reads them.

NFC EEPROMs behave like NFC tags whose memory can either be addressed through a wired (such as I2C) or NFC air interface. One benefit is that these work autonomously from a microcontroller. Some of them can also use the NFC field as a power source if they are powered off at the time.

API

There are two entry points for the API, depending on whether you are using a NFC Controller or EEPROM.

You must initiate either entry point with a driver instance, an event queue and a scratch buffer for NDEF messages.

Design

A detailed design document is available within the Mbed OS source tree. It details the rationale behind the API design.

Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.