About this demo
This Demo contains fully working software to show the implementation of two great features from the QN9080SIP-DK. The BLE in this board provides a Beacon solution to be implemented, based on the SDK example downloaded in the https://mcuxpresso.nxp.com/en/select
As previously mentioned, this demonstration is based on the Beacon example from the QN9080 SDK, along with the AN12319SW for using the NT3H2211 Tag.
The main objective of this demo software is to write a string in the NTAG memory and be able to read the content using the NTAG stack (from the AN12319 project). Then trigger a message update to be advertised from the beacon.
Project Scope
Write an NDEF message with a smartphone, using NXP's TagWrite App into the NT3H2211.
Be able to start advertising the 6-byte code/message using the BLE stack from the SDK version 2.2.3 into the MCUXpresso v11.2.1.
Useful Links
Link
Description
https://mcuxpresso.nxp.com/en/builder
SDK Builder
https://www.nxp.com/products/wireless/bluetooth-low-energy/fully-certified-module-supporting-bluetooth-and-nfc:QN9080SIP
QN9080SIP full documentation
https://www.nxp.com/docs/en/application-note/AN12319.pdf
A document explaining brief integration for pairing using the NTAG
https://www.nxp.com/docs/en/application-note-software/AN12319SW.zip
The respective Software for the AN12319
Required Items
Link
Description
https://www.nxp.com/products/wireless/bluetooth-low-energy/a-highly-extensible-platform-for-application-development-of-qn908x:QN9080DK
Board in which the demo was created and tested
Android Smartphone
Smartphone with IoT Toolbox and TagWriter App
IoT Toolbox App
https://play.google.com/store/apps/details?id=com.freescale.kinetisbletoolbox
TagWriter App
https://play.google.com/store/apps/details?id=com.nxp.nfc.tagwriter
Hardware Diagram
Step-by-Step Guide for testing the Demo
Get the QN9080 SDK form SDK Builder
Install the QN908x SDK into your MCUXpresso
Import the attached file into MCUXpresso on File > Open Projects from File System
Connect properly the NTAG antenna from the kit as shown in the Hardware Diagram.
Connect the QN9080SIP-DK using a micro-USB cable.
Flash the project into the board and Push Button 1 from the board while running.
Open the TagWriter App from your phone and select the Write option.
Create a New Plain text element and write any positive float number (< 0.0).
Select the Save and Write button.
Approach the phone into the NFC antenna.
Press Button 1 again to restart the BLE advertising
Open the IoT Toolbox App.
Select the Beacons option.
You should be able to visualize the new payload messages from the device.
Note: These messages are representation in decimal from the actual 4-byte (32-bit) number. Each letter is composed of 2, 8-bit numbers. This RAW representation is for proof of concept purposes. This application can be replaced by another BLE device in scanning mode to perform a data post-process.
Additional Demo Information
These next steps are intended to guide the developer to an easier understanding of the modifications that were made from the base project.
This example provides a guide to learn the basic functionality of the high-level NTAG stack.
Select the FreeRTOS Beacon example from wireless_examples -> Bluetooth in the QN9080 SDK.
After being sure that this demo works properly on our QN9080SIP-DK we need to import from the file system the AN12319 project.
For being sure everything works, we can also test this project, inside it there is a file called: app_ntag.c inside the source directory.
Inside this file, on the Public Functions section, we are able to modify the NDEF_Pairing_Write() and NDEF_Demo_Write() functions for our purposes.
The first function is used as the name mentions, to execute the example for pairing our phone with the board without the need to type any pairing code.
The second function writes an NDEF in the NTAG and can be read from the phone App TagInfo or TagWriter.
To start with the actual creation of the application I used this project: "qn908xcdk_wireless_examples_bluetooth_hid_device_freertos" and started importing the beacon files needed from the beacon FreeRTOS example.
As you can observe, this job facilitates a lot because of the similar structure between both projects, this will simplify the tasks and will help us not to get lost.
Due to the fact that we started using the HID Device project, all the NTAG stack was already there so we will only be going to focus on the source directory for the additions and modifications.
Starting with the erasing of the hid_device.c and .h, these files won't be required for this project.
The beacon.c and .h are required to be in this project for the beacon functionalities and routines, this files depend on the Bluetooth stack, the general framework files, and the common files from the source directory.
The app_config file has all the BLE needed configurations to set the parameters and respective structures. This is where the initial advertising message will be configured.
For the NTAG configurations, the app_ntag file containing the high-level nTag functions for Read/Write capabilities that depends on the NTAG stack (NTAG_I2C/XXX)
The ApplMain had some of the most significant changes due to being the main file that calls the BLE functions at the start and also manages the Interrupt used to trigger our own project functions using FD.
The files that changed were, as mentioned above, ApplMain.c and app_ntag.c/.h .
This has to do with the fact that we will only are going to change the functions called when a Tag Writer is in the field of the NFC antenna and how this data is processed in order to be read and sent to the aData array by using its structure.
As you can see in the app_ntag.c file, the last two functions: NDEF_read_test() and getDataNDEF() represent the main changes in this file. Along with the pin configuration for FD managing in the ApplMain.c
查看全文