How to advertise a message retrieved from the NTAG using a simple beacon example in the QN9080SIP DK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to advertise a message retrieved from the NTAG using a simple beacon example in the QN9080SIP DK

How to advertise a message retrieved from the NTAG using a simple beacon example in the QN9080SIP DK

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-bluetoo... 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-applicat... 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

 

image.png

 

Step-by-Step Guide for testing the Demo

  1. Get the QN9080 SDK form SDK Builder 
    1. image.png
  2. Install the QN908x SDK into your MCUXpresso
    1. image.png
  3. Import the attached file into MCUXpresso on File > Open Projects from File System
    1. image.png

       

  4. Connect properly the NTAG antenna from the kit as shown in the Hardware Diagram.
  5. Connect the QN9080SIP-DK using a micro-USB cable.
    1. image.png
  6. Flash the project into the board and Push Button 1 from the board while running.
    1. image.png
  7. Open the TagWriter App from your phone and select the Write option.
  8. Create a New Plain text element and write any positive float number (< 0.0).
  9. Select the Save and Write button.
  10. Approach the phone into the NFC antenna.
    1. image.png
  11. Press Button 1 again to restart the BLE advertising
  12. Open the IoT Toolbox App.
  13. Select the Beacons option.
  14. You should be able to visualize the new payload messages from the device.
    1. image.png

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. 

  1.  Select the FreeRTOS Beacon example from wireless_examples -> Bluetooth in the QN9080 SDK.
  2. After being sure that this demo works properly on our QN9080SIP-DK we need to import from the file system the AN12319 project.
  3. 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.
  4. 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.
  5. 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.
  6. The second function writes an NDEF in the NTAG and can be read from the phone App TagInfo or TagWriter.
  7. 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.
    1. 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.
    2. 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.
    3. Starting with the erasing of the hid_device.c and .h, these files won't be required for this project.
    4. 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.
    5. 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.
    6. 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)
    7. 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

Labels (1)
Attachments
No ratings
Version history
Last update:
‎11-12-2020 07:36 AM
Updated by: