Integrating NFC with the NXP PN7150 - Review

Table of contents

RoadTest: Integrating NFC with the NXP PN7150

Author: cjsieh

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?:

What were the biggest problems encountered?: The version of the FRDM-K41Z board provided uses the IRQ and VEN Arduino pinout also for the SWD Debug interface. This makes the pn7150 Arduino board incompatible with the FRDM-K41Z unless jumper wires are used instead of mounting in on top. Software changes were then needed to indicate what CPU pin the IRQ and VEN pins moved to.

Detailed Review:

Review of the NXP PN7150




In my proposal for this review I suggested replacing the RFID RC522 Reader with the PN7150 from a previously built RFID scanner.  This RFID scanner reads  MiFare Tags and publishes the UID data from the tag to a MQTT Broker via a WiFi connected ESP32.  A Google AIY Voice Kit(Raspberry Pi based) subscribed to the MQTT UID data and would "SAY" the UID data.


RC522 RFID Scanner to MQTT Broker



I also proposed that I research the use of the PN7150 with a Raspberry Pi.


The Data Flow




Basic NXP PN7150 Functionality with MCUXpresso PN7150 Example Code


I was able to replace the 522 RFID reader with the PN7150.  This required the software provided in SW4325 as described in PN7150 Application Note 11990  MCUXpresso Examples be ported to the ESP32.  The basis was the bare metal version intended for the OM13058 LPC11U68 as described in Section 2.3 .  In Section 6.1 and 6.2 it describes  how I2C and GPIO is used .   I provided equivalent Arduino IDE ESP32 functions to all of the calls to I2C  and GPIO code as used in the TML as described in section 5.3  .  I provided replacement headers files for the hardware definitions of the IRQ and VEN GPIO locations .  The following functions were replaced with code for  ESP32.  All of these were calls to the Hardware of the LPC11U68 originally.

  • i2c_Write
  • i2c_Read
  • i2c_begin
  • gpio_GetValue
  • gpio_SetValue
  • gpio_SetDir


Thus I did not have to change any of the NXP code.


Adding MQTT Functionality to MCUXpresso PN7150 Example Code


Since I was learning about NFC I wanted to know more about NTAG's .  My research showed that it was very easy to add "data" to a NTAG as NDEF records  using the NXP TagWriter Android App.  The NFC Data Exchange Format (NDEF) is a standardized data format that can be used to exchange information between any compatible NFC device and another NFC device or tag .  I decided to add NDEF Text records to my NTAG's and send this to the MQTT Broker.   Google AIY Voice Kit would then "SAY" the NDEF Text that it received via MQTT.


MQTT is a publish-subscribe messaging protocol.  It is designed for connections with remote locations where a "small code footprint" is required or the network bandwidth is limited.  It is very popular in the IOT community.


To implement MQTT with the PN7150 I had to add a call to my  "MQTT code"  after the NXP code had determined that the NDEF record was of type Text.  All other NDEF records were just printed to the serial port as the original NXP code did.


The following video shows a PN7150 reading  NTAG216, NTAG215 and NXP LPC8N04 M0/NTAG chip and sending the NDEF Text record to a MQTT Broker via a ESP32.  A Google AIY Voice Kit then uses text to voice technology to "SAY" the Text.


I am very impressed with the LPC8N04 ,  it is a M0 Microprocessor and a NTAG on the same chip.  I obtained it at a "NXP Technology Days" exhibit from Future Electronics.  Since it is just a NTAG the PN7150 can read the data on it just fine.






One thing that the PN7150 did that was better than the 522 was that the distance that was needed for a good scan was  farther away than the 522.  The 522 you had to touch the tag to the 522.  With the PN7150 i could be much farther away.




I got the PN7150 to work with the ESP32 and a Raspberry Pi Zero W and send NDEF Text data to a MQTT Broker where a Google AIY Voice Kit would "SAY" the NDEF Text.

I sure learned a lot about NTAG's and NDEF Text records and how easy they are to to write.  The Linux Demo App can also write NTAG's NDEF Records.


I did not know that there are Dynamic NTAG's where a Micro can change the contents of the NTAG on the fly.  I see this as a very powerful technology.







Provided Hardware from Element14/NXP


     PN7150 Arduino OM5578

     FRDM-KW41Z kit

I started this research with getting the  work with the software described in  OM5578 Application Note 11841 .  To do this I needed one of the supported development boards.  Choices from Section 3 show  OM13071, OM13074 or OM13058 or FRDM-K64F.  I already had a FRDM-K64F so used that first.




  • This board was NOT one of the boards mentioned in Section 3 of OM5578 Application Note 11841 mentioned above.  That was not expected since these boards were provided with the Road Test .
    • Found a port of the Example software at
      • Conflict of Arduino Pinout of OM5578 board vs provided  Rev A3 FRDM-KW41Z board
        • Pin IRQ and Pin VEN conflict with SWD Debug Pinout
        • Community Software Web page did mention that it needed a Rev B1
        • Took quite a bit of time to determine that problem was a because of A3 board since documentation made it hard to determine what Rev board we had
      • Had to change which pin IRQ and VEN were connected to on the FRDM-KW41Z via jumper wires instead of plugging the PN7150 into the FRDM-KW41Z board
      • This required a 1 line software change to the Community software example
      • See below for details



FRDM-KW41Z Hardware Pinout

Pin Name
OM5578 Pin from SchematicOM5578 Arduino Pin from Schematic



From pinout diagram

Software port/pin and Physical pin

KW41Z Jumper Wire VersionNotesSource Code Change
5VTB2 Pin 2J1 Pin 55V5VNo change
3.3VTB2 Pin 1J1 Pin 43.3V3.3VNo change
GNDTB2B Pin 2J1 Pin 6GNDGNDNo change
I2C SCLTB3 Pin 1J2 Pin 1/D15PTC2/D15PTC2/D15No change
I2C SDATB3 Pin 2J2 Pin 2/D14PTC3/D14PTC3/D14No change
IRQ/GPIO_0TB2B Pin 3J2 Pin 10/D8D8




New software pin will be


Moving to PortC.18

Which is on D6

Comment out Line  14 in Nfc/TML/src/tml.c


#define RIGADO


//#define RIGADO

VEN/GPIO_1TB2B Pin 4J4 Pin 1/D7D7




New software pin will be


Moving to PortC.17


Which is on D5

See above








Raspberry Pi Zero W


Raspberry Pi Hardware Pinout







Pin Name
OM5578 PinOM5578 Arduino Pin

Raspberry Pi Pin

Center 2 rows of Raspberry Pi Pinout Diagram

5VTB2 Pin 2J1 Pin 52
3.3VTB2 Pin 1J1 Pin 41
GNDTB2B Pin 2J1 Pin 6Any "Ground" , I used 6
I2C SCLTB3 Pin 1J2 Pin 152
I2C SDATB3 Pin 2J2 Pin 233
IRQ/GPIO_0TB2B Pin 3J2 Pin 10


VEN/GPIO_1TB2B Pin 4J4 Pin 11824



Raspberry Pi Software


I used the PN71xx Linux Software Stack Integration Guidelines AN11697 on how to use the Raspberry Pi with the PN7150.  There were 3 options for building the software

  • pn5xx_i2c
    • kernel driver
    • need to build new kernel
  • alt
    • sys/class/gpio
    • /dev/i2c-dev
    • USB HID interface


I used option "alt" for building the software.   I picked the "easiest" choice as I did not want to rebuild a kernel and there was not much documentation on how to use LPCUSBSIO.   I had to enable the I2C option in /boot/config using " sudo raspi-config" . 


This software worked just fine.


I added MQTT support to the Demo App provided at


There is also a Raspberry Pi "image" which I did not try.  I wanted to find out how hard it was to build the PN7150 library and Demo App.  The documentation in AN11697 provide enough detail.  You just have to read it very carefully as they clearly added changes later that might seem out of place.



ESP32 LolinD32


LolinD32 Hardware Pinout




Pin Name
OM5578 Arduino Pinout
ESP32 Lolin D32 Pinout
5vJ1 Pin 5USBUSB provides 5v
3.3VJ1 Pin 43.3V


J2 Pin 122
I2C SDAJ2 Pin 221
IRQ/GPIO_0J2 Pin 1032
VEN/GPIO_1J4 Pin 133


  • Pull up resisters needed on I2C SCL and I2c SDA since they are NOT provided on ESP32 LolinD32 board or OM5578 board


ESP32 LolinD32 Software


I ported the MCUXpresso PN7150 Example software for the LPC11U68 over to the ESP32 Arduino IDE.  I added replacement functions for the I2C and GPIO routines used in the MCUXpresso PN7150 Example code.  See above for more details. I added my MQTT code from my original 522 RFID Scanner.