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:
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.
Following hardware is required to run the project:
Connect the two boards as follows:
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:
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:
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.
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.
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.