Using NFC Reader Library with LPC845 (With Reduced Size)

Showing results for 
Search instead for 
Did you mean: 

Using NFC Reader Library with LPC845 (With Reduced Size)

No ratings

Using NFC Reader Library with LPC845 (With Reduced Size)

This post contains a guide of how to use the NFC Reader Library with LPC845 using the Basic Discovery Loop example. The vanilla Basic Discovery Loop example is larger than the flash size of LPC845 (64KB), so the project needs to be reduced in size as well. How to reduce the size is explained in section “Porting the NFC Reader Library and reducing the size of project”

A ready to use package “lpcxpresso845max_Basic_Discovery_Loop” example from the NFC Reader Library to be run on LPC845 and CLRC663 plus frontend is attached with this document.

This document is structured as follows:


Overview of LPC845pastedImage_2.png

The LPCXpresso-MAX family of boards provides a powerful and flexible development system for NXP's low-end Arm® Cortex®-M0+ based MCUs. They can be used with a range of development tools, including the MCUXpresso IDE toolchain. The LPCXpresso845-MAX board was created to enable evaluation of and prototyping with the LPC84x family of MCUs.

Based on the Arm® Cortex®-M0+ core, LPC845 is a low-cost, 32-bit MCU family operating at frequencies of up to 30 MHz. The LPC845 MCU contains 64 KB of flash memory and 16 KB of SRAM. 

Hardware Requirements

Following hardware is required to run the project:pastedImage_10.png

  1. LPCXpresso845-MAX development board.
  2. CLEV6630B board or BLE-NFC-V2 board. Both boards contain CLRC663 plus frontend. Here we use BLE-NFC-V2.



Connect the two boards as follows:


Porting the NFC Reader Library and reducing the size of Project:

The porting of Basic Discovery Loop Example (NFC Reader Library) to LPC845 Max was done following the procedure mentioned in “NFC Reader Library Porting to i.MX RT1050” document. However, after completing the porting and building the project, the size of the binary, which is 134.264 KB, is greater than the size of Flash of LPC845 which is 64KB of flash.


To reduce the size of the project, the following two steps were taken:

1. Apply compiler optimization for size. This can be done in the MCUXpresso by:

  1. Opening properties of project. Right Click project-   >Properties
  2. Go to Settings->Optimization.
  3. For Optimization Level choose “Optimize for Size”


Building the project after this step results in a successful build but the project takes up 93% of all Flash, leaving very little space for adding more functionality.


2. The vanilla Basic discovery loop example detects all types of NFC tags. This increases our code size, so further size reduction can be achieved by limiting the number of protocols used. To limit our Basic Discovery loop to only look for Type A tags, do the following:

  1. Open the file “ph_NxpBuild_App.h” file which is inside in the “intfs” folder. This file defines the protocols (types) which are detected by the Basic Discovery Loop example.
  2. The type A cards uses the “ISO 14443-3A” protocol, so comment out all other protocol definitions except for “ISO 14443-3A” protocol as shown in Figure.



Building the project after this step takes up only 42.784KB of space consuming 65% of the Flash, leaving sufficient amount of space for adding application code.



Running Basic Discovery Loop on LPC845

  1. If this is the first time you’re using the LPCXpresso845 Max board, follow the getting started guide first ->  LPC845Max | NXP . Make sure to install the SDK package LPCXpresso845 Max which is required for the project below to run.
  2. Download the “lpcxpresso845max_Basic_Discovery_Loop” 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: )
  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:
  5. After step 4, the project should be running now. The output “BasicDiscoveryLoop Example” can be seen in the console.


The project contains basic discovery loop functionality. Bring any NFC card near the frontend’s RF antenna and the output console will show the detection and type of the card.

Running other examples from NFC Reader Library on LPC845:

Once the “lpcxpresso845max_Basic_Discovery_Loop” project is running on the LPC845, running other examples from NFC Reader Library is simple. Here we use the “NfcrdlibEx9_NTagI2C” example from the reader library to describe the process.

  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. pastedImage_33.png
  2. In line 57 of the “ph_NxpBuild_App.h” file in “intfs” folder, replace 
  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 LPC845.


Available Resources:

  1. Porting NFC Reader Library to i.MX RT1050. (Detailed Description of porting)
  2. NFC Reader Library 
    NFC Reader Library | NXP 
  3. LPC845 Max 
    LPCXpresso845-MAX Board for LPC84x Microcontrollers (MCUs) | NXP 
Version history
Revision #:
1 of 1
Last update:
‎11-04-2019 06:15 AM
Updated by: