The Signed URL demo application firmware demonstrates the value proposition around a passive temperature monitoring use case. This application running on a label or a demo PCB can serve as a starting point for application developers to develop a full-blown solution for NFC-enabled temperature monitoring.
- Introduction
- This demo application is designed to run on an NHS31xx IC with an NFC antenna attached. For development, we recommend to use the NHS3100 temperature logger demo PCB which can be ordered directly at nxp.com/NTAGSMARTSENSOR.
The application firmware is built on top of the SDK offering: it uses the APIs exposed by the chip and board libraries, and it makes use of the available modules as much as possible.
- Getting started and how to operate
- The firmware is meant for passive use, i.e. to be used without a battery. The IC will start up every time an NFC field is present, and will die when the field is gone. When started up, the firmware will generate a URL and make it available in the NFC shared memory. The URL is guaranteed unique by the addition of GET query arguments: a unique ID is appended and a reset count. This ensures different ICs and different taps with the same IC can be discriminated. With the firmware image loaded in an NHS31xx IC, all you need next is any NFC reader. Best demo results are achieved when using an NFC-enabled Android smartphone, or an iPhone XR or higher. In that case the background reading can be used, without the need for any APP: the tag is automatically connected to, the NFC memory is read, the data parsed and the found URL opened in your mobile browser. The firmware image contains default settings and a default URL to direct the information to, but this can be configured. For this, either a dedicated mobile APP is required, or the PC application NTAG SmartSensor Automator can be used. By default, the default URL points to a server application NXP created specifically for demonstration purposes. The server folder in this project contains example code that can be run on any server to check the generated query arguments.
- Data validity
- TODO
- ARM application overview
- The execution flow of the application is described in the following diagram: TODO
- The block decomposition of the application is clarified in the following block diagram: TODO
- To enable communication of data between the tag - containing the NHS3100 IC - and a tag reader - whether it is a smartphone or a PC - the NFC controller is used to read and write NDEF messages containing MIME records. The full communication protocol is outlined below.
- Communication protocol
- For maximum compatibility, the use of NDEF messages is required: Android and iOS 13 or higher allow reading and writing the NFC interface. The firmware code relies on the NDEFT2T module to ensure that:
- all data is correctly encapsulated in a MIME record inside an NDEFT2T message
when sending data from the tag to the tag reader; and vice versa,
- to extract the payload bytes in a MIME record inside an NDEFT2T message
when receiving data from the tag reader.
- The payload bytes in a MIME record are in turn formatted according to the rules stipulated by the msg module. Detailed information about these rules can be found with msg: Message Handler. The msg module allows for the inclusion of application specific messages, which the application uses to allow setting and retrieving the configuration details and the current temperature measurement. The details about the application specific messages are captured in the protocol submodule Signed URL app.spec. messages.
- The full communication flow from tag to tag reader is largely inline with the definitions and workflow outlined in the msg module:
- (A,B) The tag reader sends a command, which is wrapped in a message containing a single MIME record,
- (C) by writing into the NFC memory. The NFC controller notifies the ARM Cortex M0+,
- (D) after which the application code reads out the command and extracts the MIME payload - using the NDEFT2T module - and feeds it to the msg module,
- (E) which then calls the registered handler function. The end result of handling is the generation of a response,
- (D) which is again wrapped in a message containing a single MIME record,
- (C) and finally copied to the NFC memory - thereby overwriting the command that was originally written by the tag reader.
- (B) The tag reader reads out the same NFC memory again, extracts the MIME payload,
- (A) and interprets the response bytes to update his logs and GUI.