Using NFC Reader Library with LPC55S69

Document created by Ali Khan Employee on May 23, 2019Last modified by Ali Khan Employee on Nov 19, 2019
Version 5Show Document
  • View in full screen mode

This post contains a guide of how to use the NFC Reader Library with LPC55S69.

A ready to use package for using the “Basic Discovery Loop” example from the NFC Reader Library with LPC55S69 and CLRC663 plus frontend is attached with this document.

This document is structured as follows:

Overview of LPC55S69:

The LPCXpresso55S69 development board provides the ideal platform for evaluation of and development with the LPC55S6x MCU based on the Arm Cortex-M33 architecture. The board includes a high performance onboard debug probe, audio subsystem and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, displays and other interfaces.

The LPCXpresso55S69 is fully supported by the MCUXpresso suite of tools, which provides device drivers, middleware and examples to allow rapid development, plus configuration tools and an optional free IDE. MCUXpresso software is compatible with tools from popular tool vendors such as Arm and IAR, and the LPCXpresso55S69 may also be used with the popular debug probes available from SEGGER and P&E Micro.

 

Hardware Requirements:

Following hardware is required to run the project:

  1. LPC55S69-EVK development board.
  2. CLEV6630B board or BLE-NFC-V2 board.

 

BLE-NFC-V2:

It is easier to use the BLE-NFC-V2 board since it can be just plugged on top of the arduino interface available on the LPCXpresso55S69 board.

The following figure shows the pin mapping between the two boards.

 

CLEV6630B board:

The CLEV6630B board consists of CLRC663 plus (NFC frontend) connected by default to an LPC1769 µC via SPI. However, the board is made in such a way that the LPC1769 MCU can be bypassed to connect to an external MCU (in our case the LPC55S69) easily. For doing so:

  • Six resistors from the board need to be removed. These are highlighted in red in the Figure 1:
  • Use the SPI pin connectors available on the left-hand side, on the board edge to connect to external MCU (LPC55S69 in this case)
  • Solder jumper wires onto the following pins of CLEV6630B Board: 
    • GND
    • IRQ
    • CLRC_NRST
    • SSEL
    • MOSI
    • MISO
    • SCK
    • IF0
    • IF1 

 

 

 

 

The CLEV6630B is shown in Figure 2 after the required changes have been made to it (Removal of resistors and soldering of wires).

 

Now connect the two boards as follows:

 

 

Running Basic Discovery Loop on LPC55S69:

 

  1. If this is the first time you’re using LPC55S69-EVK board, follow the getting started guide first à  LPC55S69-EVK | NXP . Make sure to install the SDK package for LPC55S69-EVKboard which is required for the project below to run.

  2. Download either‘lpcxpresso55s69_BasicDiscoveryLoop_CLEV6630b' or 'lpcxpresso55s69_BasicDiscoveryLoop_BLE-NFC' package which you will find attached to this post.

  3. Drag and drop the downloaded package to the “Project Explorer” tab of 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

  4. Now that the package has been imported to the MCUXpresso IDE (via drag and drop), 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:

The project should be running now. The project contains basic discovery loop functionality. Here is how the output looks like in the terminal.

 

Bring any NFC card near the frontend’s antenna and the output console will show the detection and type of the card. For example, in the picture below, we can see that type 4A card was detected:

 

 

 

Running other NFC Reader Library examples on LPC55S69:

Once the “lpcxpresso55s69_BasicDiscoveryLoop” project is running on the LPC55S69. Running other examples from is simple. First step is to install the NFC Reader Library :

Installing the NFC Reader Library:

  • Go to www.nxp.com/pages/:NFC-READER-LIBRARY
  • Go to the Downloads tab and click on the download button
  • Click download on the NFC Reader Library for Kinetis K82F package.

  • Import the library package in the workspace. The easiest way is to use the Quick Start Panel on the left-hand side:
    • Click on Import project from file system

    • Then, browse the library package in your file system.

    • Click Finish to import it all to your workspace.

 

After completing the import wizard, all projects are listed in the “Project Explorer” window. As can be seen in the screenshot, it contains different folders:

  • API documentation folder
  • Driver Abstraction Layer
  • FreeRTOS support
  • The platform support (in the screenshot, corresponding to the LPC support)
  • The software examples 
  • The Reader Library implementation
  • And the OS abstraction layer

 

 

 

Running "NfcrdlibEx9_NTagI2C" on LPC55S69:

 

Here we use the “NfcrdlibEx9_NTagI2C” example from the reader library to describe the method. The same method can be used to run other examples from the NFC Reader Library. 

To run "NfcrdlibEx9_NTagI2C" on LPC55S69, we look at "lpcxpresso55s69_BasicDiscoveryLoop" project (available as a download below) and "NfcrdlibEx9_NTagI2C" project (from the Reader Library). We make changes to the following folders:

 

  1. In “intfs” folder remove everything except the “phaApp_Init.h” file. Then go to the “intfs” folder of the NFC Reader Library example you want to run (“NfcrdlibEx9_NTagI2C” in this case), and copy all the files except “phaApp_Init.h” and paste them in the original “intfs” folder.
  2. In line 57 of the “ph_NxpBuild_App.h” file in “intfs” folder, replace

     

    #if defined(PHDRIVER_LPC1769RC663_BOARD) \

        || defined(PHDRIVER_FRDM_K82FRC663_BOARD)\

    #   define NXPBUILD__PHHAL_HW_RC663

    #endif

    with

    #if defined(PHDRIVER_LPC1769RC663_BOARD) \

        || defined(PHDRIVER_FRDM_K82FRC663_BOARD)\

        || defined(PHDRIVER_LPC55S69RC663_BOARD)

    #   define NXPBUILD__PHHAL_HW_RC663

    #endif

  3. Go to “source” folder and remove every file except “phApp_Init.c“ and “semihost_hardfault.c” files. Then go to “src” folder of the example you want to run (“NfcrdlibEx9_NTagI2C” in this case) and copy all the files except “phaApp_Init.c” and paste them into the “source” folder.

  4. Finally, copy the main file of the example you want to run (NfcrdlibEx9_NTagI2C in this case) and paste it into the “source” folder as well. The project is ready to build and run on LPC55S69.

     

 

Available Resources:

  1. Porting NFC Reader Library to i.MX RT1050. (Detailed Description of porting)
    https://community.nxp.com/docs/DOC-341843
  2. LPC55S69
    https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc5500-cortex-m33/lpcxpresso55s69-development-board:LPC55S69-EVK
  3. BLE-NFC-V2
    https://www.nxp.com/products/identification-security/rfid/nfc-hf/nfc-readers/clrc663-iplus-i-and-qn902x-nfc-bluetooth-low-energy-solution-for-consumer-applications:BLE-NFC

Outcomes