Guide for using NTAG I²C plus with i.MX RT Boards

Document created by Ali Khan Employee on Feb 25, 2019Last modified by Ali Khan Employee on Feb 27, 2019
Version 7Show Document
  • View in full screen mode

This post contains step by step guide of how to use NTAG I²C plus with i.MX RT MCUs. The goal of this post is to enable developers to start developing their NFC Applications using NTAG I²C plus and i.MX RT MCUs quickly and easily.

 

 

Attached with this post are two ready to use packages:

  1. ‘evkbimxrt1060_ntagI2C’ is to be used with MIMXRT1060-EVK and NTAG I²C plus kit for Arduino pinout.
  2. ‘evkbimxrt1050_ntagI2C’ is to be used with MIMXRT1050-EVK and NTAG I²C plus kit for Arduino pinout.

 

Both packages contain the same example code but are configured for the two different boards.

 

The example code demonstrates the following basic operations:

  1. Reading the EEPROM of NTAG I²C plus.

  2. Writing NTAG messages to NTAG I²C plus.

  3. Reading SRAM of NTAG I²C plus.

  4. Writing to SRAM of NTAG I²C plus.

  5. Using Field detect pin as interrupt to turn on an LED when an RF field is detected by the NTAG I²C board.

 

The document has been structured as follows:

 

 

NTAG I²C plus kit for Arduino pinout

The NTAG I²C plus Arduino kit consist of two PCBs stacked together:

  • The upper PCB is the antenna board with the connected tag
  • The lower PCB is an interface adaptor board to the Arduino pinout

This kit can be used to connect and evaluate the NTAG I²C plus  into many popular MCUs with Arduino compliant headers, for example:  Kinetis (e.g. KW41Z, i.MX (e.g. UDOO Neo, i.MX 6UL, i.MX 6 ULL, i.MX 7D), LPC MCUs (e.g. LPCXpresso MAX, V2 and V3 boards) and i.MX RT boards (e.g. i.MX RT1050, i.MX RT1060) The kit support package includes several software examples.

The OM29110ARD is a generic interface board which offers support for connection to any PCB implementing Arduino connectors. It exposes:

  • 3.3V and 5V power supply pins.
  • I2C, SPI and UART host interfaces.
  • Generic GPIOs (e.g. to be used for field detect, interrupts, reset pins or others)

As such, it allows the NTAG I²C plus to be plugged into Arduino devices seamlessly.

 

Hardware Requirements

  • EVKB-IMXRT1050 board or EVKB-IMXRT1060 board.
  • NTAG I²C plus kit for Arduino pinout (OM23221ARD)
  • Cables:
  • Micro USB cable
  • 6 jumper wires Male to Female (Only required if using EVKB-IMXRT1050 board)

 

Using NTAG I²C plus kit for Arduino pinout with EVKB-IMXRT1060

Hardware Connections

The hardware connections are simple. Both the EVKB-IMXRT1060 board and OM23221ARD (NTAG I²C plus) board have Arduino interface. So simply connect both as shown in figure: 

 

Running the Demo

Follow the below mentioned steps to run the demo:

 

  1. Download the ‘evkbimxrt1060_ntagI2C’ package which you will find attached to this post. 

  2. Drag and drop the downloaded package to your MCUXpresso IDE workspace (If you don’t have MCUXpresso, it can be downloaded for free from here: https://www.nxp.com/support/developer-resources/software-development-tools/mcuxpresso-software-and-tools/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE

  3. Now that the package has been imported to the MCUXpresso IDE, click on Debug icon from the Quickstart panel to begin a debug session. Once the debug session has started click on the run icon to run the code:                                
    Note:  If this is your first time using IMXRT1060EVK board, it is recommended to follow the getting started guide first ( i.MX RT1060 Evaluation Kit | NXP  )

  4. To see the output, you need to have a terminal application installed (like Tera term or PuTTY). The output looks like this: 

                                                 

 

Using NTAG I²C plus kit for Arduino pinout with EVKB-IMXRT1050

Hardware Connections

In case of EVKB-IMXRT1050, the I2C pins on the Arduino interface’s J24 pin 9 and 10 are only connected to the i.MX RT slave I²C port, not to a master I²C port. So, we cannot just plug in the NTAG I²C plus kit, instead we need to connect two boards with the help of jumper wires. The connections required are show in figure below.

                              

 

Running the Demo

 

  1. Download the ‘evkbimxrt1050_ntagI2C’ package which you will find attached to this post.
  2. Drag and drop the downloaded package to your MCUXpresso IDE workspace (If you don’t have MCUXpresso, it can be downloaded for free from here: https://www.nxp.com/support/developer-resources/software-development-tools/mcuxpresso-software-and-tools/mcuxpresso-integrated-development-environment-ide:MCUXpresso-IDE
  3. Now that the package has been imported to the MCUXpresso IDE, click on Debug icon from the Quickstart panel to begin a debug session. Once the debug session has started click on the run icon to run the code:
                            
         

    Note:  If this is your first time using IMXRT1050EVK board, it is recommended to follow the getting started guide first ( i.MX RT1050 Evaluation Kit | NXP  )

  4. To see the output, you need to have a terminal application installed (like Tera term or PuTTY). The output looks like this:

                                          

 

Porting the Package to any other i.MX RT Boards

   If you want to use NTAG I²C plus with i.MX RT boards other than the i.MX RT1050 or the i.MX RT1060, then you’ve       to port the example package. This is fairly straightforward and the procedure is described below:

  1. Import the ‘hello world’ project from the SDK of the board to which you want to port the package. (SDKs for every board are freely available for download from the MCUXpresso SDK Builder website).We will modify this ‘hello world’ project adding code from attached packages, to make it work on the desired board.
                                       
  2. Copy the following folders from the attached ‘evkbimxrt1060_ntagI2C’ or ‘evkbimxrt1050_ntagI2C’ package to the ‘hello world’ project imported in step 1:
                                 
    Copy the two files to the ‘drivers’ folder of ‘hello world’ project:

     

     

    Delete the ‘hello_world.c’ file from the source folder:



  3. Now copy the following preprocessor micros from ‘evkbimxrt1060_ntagI2C’ or ‘evkbimxrt1050_ntagI2C’ package to ‘hello world’ project:

         Preprocessor settings can be found by right clicking Project-Properties>C++Build > Settings

  4.  Now we need to change the project configuration: 
          a.  Add the newly copied folders to source location; Right click on Project->Properties and add the following        folders:

      

    b.  Include paths to the added libraries in the project. These can be copied from the from ‘evkbimxrt1060_ntagI2C’ or ‘evkbimxrt1050_ntagI2C’ package. Open project->properties and copy the following in the respective places as shown in the images: 

  5. Change pin configurations according to the board pins you are using:
                a. For changing field detect pin, the code can be found in the source file:

                     
    b. For I2C instance, the lines of code are in app_ntag->app_ntag.h:

               
     c. These pins also need to be initialized which can be done through the pin initialization tool of MCUXpresso or code can be added to the ‘board.c’ file in ‘board’ folder.

  6. Once these changes are done, porting is complete. Build the project, it should build without any errors.

 

Available resources

  1. BLE pairing with NFC on KW41 and NTAG I²C plus source code www.nxp.com/downloads/en/snippets-boot-code-headers-monitors/SW4223.zip
  2. NTAG I²C plus kit for Arduino pinout www.nxp.com/demoboard/OM23221ARD

 

 

1 person found this helpful

Outcomes