NFC Knowledge Base

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

NFC Knowledge Base

Discussions

Sort by:
Recently, some NFC customer want to use CCID driver to communcate with NFC reader on Linux platform, but they encontered some errors during installing CCID driver for linux. I tested it and installed it to ubuntu 16.04 LTS successfully. Let me share complete steps with those users who want to devevlope NFC applications based on linux platform. If we want to use CCID driver on linux, we need to install these packages: --libusb --pcsc-lite --ccid driver --opensc Before starting to install above packages, probably we need to install necessary dependency packages: # sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev # sudo apt-get install x11proto-core-dev libx11-dev lib32readline-gplv2-dev lib32z1-dev # sudo apt-get install libgl1-mesa-dev mingw32 tofrodos python-markdown libxml2-utils xsltproc uuid-dev:i386 liblzo2-dev:i386 # sudo apt-get install gcc-multilib g++-multilib # sudo apt-get install subversion # sudo apt-get install openssh-server openssh-client # sudo apt-get install libudev-dev # sudo apt-get install openssl  # sudo apt-get install libssl-dev 1. libus installation (1) Download it from : libusb File name is libusb-1.0.9.tar.bz2 (2)Decompressing it # tar jxvf libusb-1.0.9.tar.bz2 # cd ~/ccid/libusb-1.0.9 # ./configure # make # sudo make install (3) test it # lsusb 2. pcsc-lite installation (1) Downloading pcsc-lite package: MUSCLE  Filename is : pcsc-lite-1.8.22.tar.bz2  (2) Decompressing it # tar jxvf pcsc-lite-1.8.22.tar.bz2  (3) compiling it # cd pcsc-lite-1.8.22 # ./configure # make ... # sudo make install ... 3. CCID driver installation (1) Downloading it from : Alioth: Muscle PCSC lite: Project Filelist  file name is : ccid-1.4.27.tar.bz2 (2) Decompressing it # tar jxvf ccid-1.4.27.tar.bz2 (3) Compiling it # cd ccid-1.4.27 # ./configure After runing configure command, information below will be displayed: ... # make ... # sudo make install ... 4. opensc installation (1) Downloading it from : OpenSC - Browse /OpenSC/opensc-0.16.0 at SourceForge.net  File name is : opensc-0.16.0.tar.gz (2) Decompressing it # tar zxvf cd opensc-0.16.0.tar.gz (3)Compiling it # cd opensc-0.16.0 # ./configure --enable-openssl --enable-pcsc # make # sudo make install Up to now, above 4 software packages have been installed to ubuntu 16.04 LTS. (4) Add library file path    open /etc/ld.so.conf , and add one line at the end of the file :  include /usr/local/lib , save and exit, run 'sudo ldconfig -v' to update it. # sudo gedit /etc/ld.so.conf  # sudo sudo ldconfig -v 5. Add Vendor ID & Product ID to info.plist We should add Vendor ID & Product ID of NFC reader to info.plist, the file is at the path : /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/. For example , PN7462's vendor ID is 0x1FC9, and product ID is 0x0117. [Note] This requires Firmware on NFC reader board should support USB CCID, if not, customer should replace it with firmware that supports USB CCID, for the purpose, customer can refer to UM10915.pdf(http://www.nxp.com/docs/en/user-guide/UM10915.pdf ) to do it. TIC team Weidong Sun
View full article
  NXP offers FW update code as part of the SW6705.   All PN7160 FW versions including ".c" files are available on PN7160 Github.    PN7160 is typically delivered with the initial FW 12.50.05. To ensure full reliable functionality, it is highly recommended to update the FW on 12.50.09 (or latest). The FW update might be also helpful if you need to restore the default EEPROM settings.  The FW source data are inside the sFWudpate folder.  phDnldNfc_UpdateSeq.c -> FW Version 12.50.05 phDnldNfc_UpdateSeq_12_50_09.c -> FW Version 12.50.09 The phDnldNfc_UpdateSeq.c is executed, which means what is inside of this "C" file is pushed to the PN7160 EEPROM.  So, if you want to update from 12.50.05 to 12.50.09. You need to copy content from phDnldNfc_UpdateSeq_12_50_09.c to The phDnldNfc_UpdateSeq.c.  Also, make sure that the content in phDnldNfc_UpdateSeq_12_50_09.c is commended.   Once that's done, you can debug the code.  Then you can check the progress in "Terminal"    Tomas Parizek  Customer Application Support 
View full article
Extended NFC Factory Test Application includes:  Get Current value (current measurement in mA) DPC Check (Available from FW. Version 12.50.06) Get AGC Value  Get AGC Value NFCLD (AGC value reading with fixed NFC Level Detector level) Dump EEPROM settings    How to get it:  Just download the app from Github. Replace the "NfcFactoryTestApp.c" with the file which is here in the attachment.  Run the application as described in ->AN13287.   Tomas Parizek  Customer Application Support 
View full article
As NFC reader library 5.12 also supports PN5180, switching the NFC frontend from CLRC663 to PN5180 is quite easy based on previous porting. The porting also includes the hardware settings and software modification. Hardware Setup for porting: a) Remove resistors on PNEV5180B to disconnect the onboard lpc1769 from PN5180, following steps on page 16 of https://www.nxp.com/docs/en/application-note/AN11908.pdf  b) Connect LPCXpresso board for LPC11U37 with PNEV5180 as below: Software Modification for porting: 1. Make a copy of Board_Lpc11u37Rc663.h , and change its name to "Board_Lpc11u37Pn5180.h", and import it into the DAL/boards folder. 2.Change the source code in the header file as below: 3. Add two more pins' definition and configuration for BUSY and DWL pins of PN5180, and new configuration for reset pin. and modify the reset logic: 4.Change the IRQ interrupt trigger type to rising edge. 5.Include this header file in BoardSelection.h 6.Add this new configuration in ph_NxpBuild_App.h 7.Add this new configuration in phApp_Init.h 8.Add this new configuration in ph_NxpBuild_Platform.h 9.Add this new configuration in Settings. 10.Building result: Testing result:
View full article
Environments & Devices --Hardware 1、PN7462 DEMO Board(PNEV7642B) --Software 1、Ubuntu 16.04 desktop 2、Test tools ---libusb ---pcsc-lite ---ccid driver ---opensc          Before testing, please install above test tools to Ubuntu 16.04 according to document on the link https://community.nxp.com/docs/DOC-334952 !          Then follow steps below to begin testing PN7462 DEMO board by above test tools. 1、Update firmware of PN7462 DEMO board          Please update firmware of PN7462 DEMO board according to UM10915.pdf, then test it on windows, ensuring PN7462 DEMO board can normally work at CCID protocol on window platform. 2、Connecting PN7462 DEMO Board to PC USB via USB OTG Cable.          On PENV7462B side, X3 connector should be used for USB OTG cable. 3、Using lsusb to list USB devices weidong@ubuntu:~$ lsusb Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 004: ID 0e0f:0008 VMware, Inc. Bus 002 Device 005: ID 1fc9:0117 NXP Semiconductors          Last line is PN7472 DEMO board. 4、Open 2 terminals at the same time on Ubuntu desktop (1) One terminal is used to run “pcsc” command weidong@ubuntu:~$ sudo /usr/local/sbin/pcscd -adf [sudo] password for weidong: 00000000 pcscdaemon.c:345:main() pcscd set to foreground with debug send to stdout 00012288 configfile.l:361:DBGetReaderList() Parsing conf file: /usr/local/etc/reader.conf.d 00000037 pcscdaemon.c:658:main() pcsc-lite 1.8.22 daemon ready. 00023126 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0001, path: /dev/bus/usb/002/001 00000101 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0001, path: /dev/bus/usb/002/001 00000113 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0003, path: /dev/bus/usb/002/002 00000112 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0001, path: /dev/bus/usb/002/001 00000160 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0002, path: /dev/bus/usb/002/003 00000152 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0008, path: /dev/bus/usb/002/004 00000115 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0008, path: /dev/bus/usb/002/004 00000165 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x0E0F, PID: 0x0002, path: /dev/bus/usb/002/003 00000263 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1D6B, PID: 0x0002, path: /dev/bus/usb/001/001 ^V56546837 hotplug_libudev.c:651:HPEstablishUSBNotifications() USB Device add 00000101 hotplug_libudev.c:297:get_driver() Looking for a driver for VID: 0x1FC9, PID: 0x0117, path: /dev/bus/usb/002/006 00000007 hotplug_libudev.c:436:HPAddDevice() Adding USB device: PN7462 USB Reader 00000045 readerfactory.c:1074:RFInitializeReader() Attempting startup of PN7462 USB Reader (1.00) 00 00 using /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Linux/libccid.so 00127887 readerfactory.c:949:RFBindFunctions() Loading IFD Handler 3.0 00000236 ifdhandler.c:1965:init_driver() Driver version: 1.4.27 00000477 ifdhandler.c:1982:init_driver() LogLevel: 0x0003 00000004 ifdhandler.c:1993:init_driver() DriverOptions: 0x0000 00000165 ifdhandler.c:111:CreateChannelByNameOrChannel() Lun: 0, device: usb:1fc9/0117:libudev:0:/dev/bus/usb/002/006 00000021 ccid_usb.c:302:OpenUSBByName() Using: /usr/local/lib/pcsc/drivers/ifd-ccid.bundle/Contents/Info.plist 00000727 ccid_usb.c:320:OpenUSBByName() ifdManufacturerString: Ludovic Rousseau (ludovic.rousseau@free.fr) 00000016 ccid_usb.c:321:OpenUSBByName() ifdProductString: Generic CCID driver 00000004 ccid_usb.c:322:OpenUSBByName() Copyright: This driver is protected by terms of the GNU Lesser General Public License version 2.1, or (at your option) any later version. 00000433 ccid_usb.c:656:OpenUSBByName() Found Vendor/Product: 1FC9/0117 (PN7462 USB Reader) 00000005 ccid_usb.c:658:OpenUSBByName() Using USB bus/device: 2/6 00000021 ccid_usb.c:717:OpenUSBByName() bNumDataRatesSupported is 0 00128471 ifdhandler.c:382:IFDHGetCapabilities() tag: 0xFB3, usb:1fc9/0117:libudev:0:/dev/bus/usb/002/006 (lun: 0) 00000027 readerfactory.c:396:RFAddReader() Using the reader polling thread 00004709 ifdhandler.c:382:IFDHGetCapabilities() tag: 0xFAE, usb:1fc9/0117:libudev:0:/dev/bus/usb/002/006 (lun: 0) 00000023 ifdhandler.c:477:IFDHGetCapabilities() Reader supports 1 slot(s) (2)The other terminal is used to run “"testpcsc " in pcsc-lite/src source code weidong@ubuntu:~/ccid/pcsc-lite-1.8.22/src$ ./testpcsc   MUSCLE PC/SC Lite unitary test Program   THIS PROGRAM IS NOT DESIGNED AS A TESTING TOOL FOR END USERS! Do NOT use it unless you really know what you do.   Testing SCardEstablishContext        : Command successful. Testing SCardIsValidContext   : Command successful. Testing SCardIsValidContext   : Invalid handle. (don't panic) Testing SCardListReaderGroups      : Command successful. Group 01: SCard$DefaultReaders Testing SCardFreeMemory               : Command successful. Testing SCardListReaders        : Command successful. Testing SCardListReaders        : Command successful. Reader 01: PN7462 USB Reader (1.00) 00 00 Waiting for card insertion        :          2 screenshots for above 2 terminals: 5、Test cards (All cards are contactless) (1) MIFARE Plus x 4K card Re move it: (2) MIFARE Nano card          Note: testpcsc should be run again. Remove it: (3) MIFARE EV1 card Remove it: 6、Using Opensc-tool to Test cards            Open a new terminal for running the command, please! (1)No cards (2) MIFARE Plus x 4K card (close to antenna , then run opensc-tool) (3) MIFARE Nano card (4) MIFARE EV1 card    TIC Weidong Sun 2018-07-09
View full article
This document provides a step by step guide of how to use the CLRC663 plus with i.MX RT1050. For this purpose, we need to port the NFC Reader Library to i.MX RT1050.  There are two zip files attached to this document: 1. "NFCReaderLibrary_IMXRT1050_Porting Guide +DAL_IMXRT1050_BLE-NFC-V2.zip" : This folder is pre-configured for those who want to use BLE-NFC-v2 board with i.MX RT1050. 2. "NFCReaderLibrary_IMXRT1050_Porting Guide +DAL_IMXRT1050_CLEV6630B.zip" : This folder is pre-configured for those who want to use CLEV6630B board with i.MX RT1050. A video describing how to use i.MX RT1050 with CLRC663 Plus Family is available by clicking this link (Using i.MX RT 1050 with CLRC663 plus family |NXP ) as well. 
View full article
The Raspberry Pi Foundation released the Raspberry Pi 5 in October 2023, Raspberry Pi 5 features the Broadcom BCM2712 quad-core Arm Cortex A76 processor @2.4GHz, making it up to three times fast than Raspberry Pi 4.   The latest version of Raspberry Pi OS is Bookworm. However, some customers found the PN7160 is not detected over I2C/SPI on the Raspberry Pi 5. Running "i2cdetect -y 1" produces a blank table, and running "nfcDemoApp poll" results in an "nfcservice init fail" message. The incompatibility appears to be between the PN7160 and the new Raspberry Pi OS—Bookworm.  This reason is Raspberry Pi OS received a major update in Linux Kernel 6.6,  the classic way of GIPO handling no long work.   In step 6, a new GPIO interface is introduced to resolve the incompatibility issue. This article is a step-by-step guide to port PN7160 NCI2 stack to Raspberry Pi OS--Bookworm.   Hardware setup: For detail information about Raspberry Pi 5, please refer to below link.  https://www.raspberrypi.com/products/   The PN7160 EVK board must be connected to Raspberry Pi using the following instructions:   Raspberry Pi 5 board pin NFC controller board signal #1 3.3V PWR VDD (PAD) +5V VBAT and VDD (UP) #16 GPIO23 IRQ #18 GPIO24 VEN #22 DWL_REQ #6 GND #5 I2C_SCL #3 I2C_SDA     This matches the Raspberry Pi version of OM27160A1EVK (I2C variant).  The kit can then be plugged on Raspberry Pi 5 board to run the example. First of all, assemble the PN7160 NFC controller board (OM27160A1HN or OM27160B1HN) with the Raspberry Pi interface board (OM29110RPI)      Then stacked together the boards with the Raspberry Pi board.     Software Setup: 1    Install Rasp 5 OS -Bookworm We use Raspberry Pi Imager tool to install Raspberry Pi OS (64bit, Bookworm). Click choose device and select Raspberry Pi 5, next click choose OS and select an operating system –Raspberry Pi OS (64-bit) , and select Micro SD card. Next we can write the Image to the Micro SD card.   2 Enable i2c interface 1). Run command:     sudo raspi-config     2). Use the down arrow to select "Interface Options"   3). Arrow down to "I5 I2C"     4). Select "yes" when it asks you to enable I2C 5). Use the right arrow to select the <Finish> button To verify the i2c interface is enabled, enter the following command: $ ls /dev/i2c* The Pi should respond with “ /dev/i2c-1” which represents the user-mode i2c interface to which is connected the PN7160    3 Install necessary tools   We need to use APT commands to install , update software package in Raspberry Pi OS, please refer to  below link. https://www.raspberrypi.com/documentation/computers/os.html Libtool needs to be installed to run the NCI stack.    4 Clone Linux libnfc-nci library repository NFC NCI library is available from the following repository: https://github.com/NXPNFCLinux/linux_libnfc-nci $ git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git -b NCI2.0_PN7160     5 Apply 64bit patch To install on 64bit OS, we need to apply 64bit patch.  It is under folder linux_libnfc-nci/64bit_patch/ROOT_src.patch   6 Modifications for GPIO Raspberry Pi OS (Bookworm) received a major update which includes the Linux kernel 6.6.   In the new OS update, the classic way of interfacing with GPIO has been deprecated.  Unfortunately our PN7160 NCI stack still interact with GPIO using /sys/class/gpio pseudo-filesystem,  low level control of GPIOs no longer work with Bookworm.  So we need to use the new GPIO interface on the Raspberry PI: libgpiod.  At this point Raspberry OS with a kernel 6.6 both libgpiod and gpiod are not pre-packaged and we need to install them.   6.1  Installation of gpiod tools We can look more into what is installed   The output of gpioinfo reports all of the available GPIO lines, by default for all chips. 6.2 Installation of the gpio libraries If we want to install libraries for development we need to do the following   Here is the info on libgpiod-dev     The development package installs the C libraries and header files for us to use. Namely, the /usr/include/gpiod.h C header file and the /usr/lib/arm-linux-gnueabihf/libgpiod.so Shared Library.   6.3 Modifications in PN7160 NCI2 library. In source code, we need to add the gpiod library support 6.3.1 Makefile.am    6.3.2 src/nfcandroid_nfc_hidlimpl/halimpl/tml/transport/NfccAltTransport.cc    ......     and src/nfcandroid_nfc_hidlimpl/halimpl/tml/transport/NfccAltTransport.h   If you need the modified source code files, please let me know. I can send the source code changes to you.    7 Configure the library       8 Set the library to map i2c interface   9 Build and install the library   $ make $ sudo make install $ export LD_LIBRARY_PATH=/usr/local/lib   10 Run & Verify the NFC functionality     This demo works as expected.   Summary: Porting PN7160 NCI2 stack to Raspberry Pi 5, we need to follow PN7160 Linux porting guide and update the classic GPIO interface to gpiod libraries.   Happy porting 😊
View full article
The code is based on the application note https://www.nxp.com.cn/docs/en/application-note/AN12657.pdf. It mostly shows how to communicate between LPC1769 and RC663 via SPI based on board CLEV6630B without library and which Register have to be set to send a REQA (NTAG21x).
View full article
Please kindly refer to the attachment for details.   Hope that helps,
View full article
Hello NFC and Kinetis enthusiasts, NTAG I2C plus tag ICs offer both, a contact (I2C) and a contactless interface (NFC) to ease the development of IoT, home-automation and consumer applications. The target of this document and the example projects is to show how NTAG I2C plus can act as the bridge from a host NFC device, like a smartphone or PC, to an embedded board such as a Kinetis Freedom board. 2 main functionalities are demonstrated: embedded board control via NFC and firmware upgrades over NFC. Board control with NFC enabled device NTAG I2C plus provides an easy way of sending/receiving any kind of data between a product embedding an MCU to a host NFC device (e.g. smartphone). Some use cases include product configuration, control or data sensing. A major advantage is that we can have a customized application or graphic interface in the smartphone instead of expense of an LCD screen for the embedded board. Bootloader over NFC Firmware updates in the field are a very common practice for products based in an embedded system. The main advantages of a bootloader over NFC are the simplicity and the non intrusive nature, as it communicates using NFC antennas, i.e. without any wires or physical connections. DEMO PROJECT The next picture shows the setup and connections from the NTAG I2C Plus antenna board to the FRDM-K64F. Hardware - Kinetis Freedom board FRDM-K64F - NTAG I2C Plus Antenna board or flex antenna with the NTAG I2C plus IC. Software - Kinetis Software Development Kit (KSDK) v2.0 - Kinetis Design Studio (KDS) v3.2 - NTAG I2C Demo Android application. Available from Google Play. :smileyalert: Note: Please verify that your smartphone supports NFC. Otherwise the Android app can be installed but it cannot be used for interfacing with the NTAG I2C Plus IC. TESTING THE DEMO PROJECTS There are two KDS projects attached to this document: - NTAG_I2C_Plus_FRDMK64_Demo: Demonstrates the transfer of data between the phone and the MCU. - NTAG_I2C_Plus_FRDMK64_Bootloader: Provides a mean to update the firmware in the Kinetis MCU. The application must be prepared to be placed at an offset of 0x4000 in the MCU internal flash. To load any of these demos please open the corresponding project in KDS IDE, build the project and start a debugger session to program the K64. NTAG_I2C_Plus_FRDMK64_Bootloader 1- In FRDM-K64F, SW2 must be pressed during reset to enter bootloader mode. Hence the 2 usual ways are:+    A) If the board is powered, press and hold SW2 and then press Reset button.    B) When the board is not powered, press and hold SW2 and then plug the USB cable. 2- From the Android demo app go to the "Flash" option. Then click on "Select from Storage" to browse for the application binary file. :smileyinfo: Note: For this bootloader example, the application including the vector table must be relocated to an offset of 0x4000 in Flash. 3- Finally tap the phone to the NTAG I2C Plus antenna and hold it steady during the flashing progress. When the app shows "Flash Completed" the new application starts executing. NTAG_I2C_Plus_FRDMK64_Demo :smileyalert: NOTE: By default the demo project has the 0x4000 offset, so please build the project and then load the generated binary using the bootloader as described above. - Bring the NFC enabled phone near the NTAG I2C Antenna. - Verify transfer is already in progress, by checking the "Board Status". - Press the Orange/Blue/Green buttons in the Android app to change the color of the RGB LED. - Enable the checkbox for "Enable Temperature Sensor" to see the reading of the K64 internal temperature. I hope these demo projects are useful. Please feel free to share your comments or ask any questions. Regards! Jorge Gonzalez
View full article
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: ‘evkbimxrt1060_ntagI2C’ is to be used with MIMXRT1060-EVK and NTAG I²C plus kit for Arduino pinout. ‘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: Reading the EEPROM of NTAG I²C plus. Writing NTAG messages to NTAG I²C plus. Reading SRAM of NTAG I²C plus. Writing to SRAM of NTAG I²C plus. 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: Download the ‘evkbimxrt1060_ntagI2C’ package which you will find attached to this post.  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 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  ) 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 Download the ‘evkbimxrt1050_ntagI2C’ package which you will find attached to this post. 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 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  ) 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: 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.                                     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: 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  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:  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. Once these changes are done, porting is complete. Build the project, it should build without any errors. Available resources 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 NTAG I²C plus kit for Arduino pinout www.nxp.com/demoboard/OM23221ARD    
View full article
This post contains step by step guide of how to use the NTAG I²C plus with LPC55S69. This is easy and straightforward to do, since the MCUXpresso SDK Builder tool has an option to add NTAG I²C plus example directly to SDK of LPC55S69. Hardware Needed: LPC55S69-EVK NTAG I²C plus explorer kit Follow the following simple steps to use NTAG I²C plus with LPC55S69: Download and install MCUXpresso IDE (if you don’t have it already). It can be download for free by clicking here: Next step is to use the MCUXpresso SDK Builder tool to build and download the SDK for LPC55S69. For this: Go to  the MCUXpresso SDK Builder website: https://mcuxpresso.nxp.com/en/select Select the LPC55S69 board and then click on ‘Build MCUXpresso SDK’ button: Click on ‘Add Software component’, then select the NTAG I2C component, click ‘Save changes’ and then download the SDK. Drag and drop the downloaded SDK to the installed SDK’s tab in the MCUXpresso IDE to install it. Click on the ‘Import SDK example(s)’ in the Quickstart Panel in the MCUXpresso IDE. Then select LPC55S69, ‘check the ntag_i2c_plus_example’ box and hit ‘Finish’. Connect the LPC55S69 and NTAG I²C plus boards together. Details of these connections can be found in the “readme.txt” file in the “doc” folder of the project: Finally click on debug in the Quickstart Panel to build the project, flash it to the MCU, and start debugging. This is how the output looks like in the Console tab of IDE: Bring any active nfc device (e.g. an NFC phone with NFC enabled) near the ntagi2c board. The program will detect it and consequently blink the LED as well as display a message on the console: Read the “readme.txt” file for more details regarding the project. Available Resources: 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 NTAG I²C plus kit for Arduino pinout www.nxp.com/demoboard/OM23221ARD
View full article
When the PNEV5180B cannot work with the Cockpit, you can re-program the firmware to the board. Below are the steps show you how to program the firmware to the board again. 1. If you don't have the MCUXpresso, please download the MCUXpresso from the NXP web first. MCUXpresso Software and Tools for ARM® Cortex®-M cores|NXP  2. Install the MCUXpresso IDE v10.0.0 to your PC. 3. Configure PNEV5180 board to use external power supply J101, and then power up the board. There is 10-pin ARM Cortex header on the PNEV5180B , connect  LPC-Link2 debug probe to it (J7) by using flat cable and also connect debug probe to the PC host over USB mini cable - both jumper on debug probe are open (JP1 and JP2). 4. Start MCUXpresso IDE and import any LPC1769 project from filesystem. For example: SW3522.zip. This is important to give programmer right definitions. SW3522 can be downloaded from here : NFC Reader Library v4.040.05.011646 R1 for PNEV5180B including all software examples  5. After import the SW3522, you can try to build the example and run the example on your board. e.g. NfcrdlibEx1_BasicDiscoveryLoop. Click LinkServer GUI Flash programmer icon on the main menu. When started programmer tool will check if LPC-Link2 debug probe is attached. 6. Browse to the C:\nxp\NxpNfcCockpit_v4.0.0.0\firmware\Secondary_PN5180\BootLoader_And_Nfcrdlib_SimplifiedAPI_EMVCo_Secondary.bin. Set the Base address to 0x0. 7. Flash Write Done. 8. After this, reset the board and to start NFCCockpit v4.0.0.0. The board will be recognized. P.S. The board is connected to PC via VCOM. If there is any driver issue, please try to re-install the VCOM driver and restart the PC. The VCOM driver can be found in the C:\nxp\NxpNfcCockpit_v4.0.0.0\VCOM.
View full article
This post contains step by step guide of how to use NTAG 5 with LPC55S69. The goal of this post is to enable developers to use NTAG 5 and LPC55S69 together, quickly and easily.    Attached with this post are two ready to use packages:      'Simple_NDEF’ demonstrates how to read/write to NTAG 5 from the I 2 C  interface and field detection functionality.      'Passthrough’ demonstrates SRAM passthrough functionality, in which NTAG 5 acts as a fast bridge between the I 2 C interface device and RF interface device. NTAG 5 Overview NTAG 5 is a family of ISO/IEC 15693 and NFC Forum Type 5 Tag compliant tags with an EEPROM, SRAM, and I 2 C  host and slave interface. This ensures information exchange with all NFC Forum Devices with a tap. With this ability, the tag offers a long-reading range and privacy due to close proximity with mobile devices. NXP’s NTAG 5 boost shrinks the NFC footprint while adding AES security, so designers can deliver ultra-compact devices for use in IoT, consumer, and industrial applications. It is an NFC Forum-compliant contactless tag that delivers exceptional read range, giving tiny devices the ability to interact with the cloud, and other NFC-enabled devices, including smartphones. NXP’s NTAG 5 link lets designers of sensor-equipped systems add an NFC interface with a wired host interface that’s configurable as an I 2 C master/slave, a Pulse Width Modulator (PWM), or a General-Purpose I/O (GPIO). Operating at 13.56 MHz, it is an NFC Forum-compliant contactless tag that can be read and written by an NFC-enabled device at close range and by an ISO/IEC 15693-enabled industrial reader over a longer range. Hardware Requirements NTAG 5 Evaluation Board (OM23510ARD)                         OM23510ARD                                     2. LPCXpresso55S69 Board Hardware Connections Connecting the two boards is very easy since both have Arduino compatible headers, so simply plug the NTAG 5 EVK board on top of the LPCXpresso55S69 board.   1. Running 'Simple_NDEF' on LPC55S69 with NTAG 5 If this is the first time you’re using the LPCXpresso55S69 board, follow the getting started guide first LPC55S69-EVK. Make sure to install the SDK package for the LPC55S69 board which is required to run the project. Download the ‘Simple_NDEF’ package which you will find attached to this post. 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 Now that the package has been imported to the MCUXpresso IDE (via drag and drop), click on the 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 3, the project should be running now. Here is how the output looks in the terminal: 2. Running 'Passthrough' on LPC55S69 with NTAG5 If this is the first time you’re using the LPCXpresso55S69 board, follow the getting started guide first an LPC55S69-EVK | NXP. Make sure to install the SDK package for the LPC55S69 board which is required to run the project. Download the ‘Passthrough’ package which you will find attached to this post. 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  Now that the package has been imported to the MCUXpresso IDE (via drag and drop), click on the 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 3, the project should be running now. To check the passthrough functionality, install the NTAG 5 App and then go into passthrough functionality. Available Resources LPC55S69-EVK: LPCXpresso55S69 Development Board https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/general-purpose-mcus/lpc5500-cortex-m33/lpcxpresso55s69-development-board:LPC55S69-EVK NTAG 5 link: NFC Forum-compliant I²C bridge for IoT on-demand | NXP  NTAG 5 boost: NFC Forum-compliant I²C bridge for tiny devices | NXP 
View full article
Hello NFC community, The purpose of this document is to show the steps to port the Bluetooth pairing example for NTAG I²C Plus from KW41Z to KW36.  Setup For this, we will work with following boards: 1. Arduino NTAG I²C plus board (OM23221ARD) development kit. 2. KW36 Freedom board.  Download SDK as mentioned in chapter 2.1.3 of KW41Z User Manual and pay close attention to include NTAG I²C middleware. Now, repeat the same procedure above for FRDM KW36, this will be the SDK on which we will be making the modifications for the porting. NOTE: Unlike KW41Z, for KW36 there is no NTAG I²C plus middleware as shown in the image below: Save changes and build the SDK. NTAG I²C middleware will have to be imported from KW41Z's SDK in MCUXPresso. Install the SDK and import hid _device freertos example into the workspace: Copy ntag_i2c_plus_1.0.0 folder from KW41Z workspace to KW36's Open folder properties and uncheck Exclude resources from build, then apply and close. In board.c file add the following code below BOARD_DCDCInit()  /* Init DCDC module */ BOARD_DCDCInit(); #ifdef NTAG_I2C /* Init I2C pins for NTAG communication */ BOARD_InitI2C(); #endif // NTAG_I2C‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ In AppIMain.c add the following code in main_task before calling App_Thread()  #ifdef NTAG_I2C /* Initialize I2C for NTAG communication */ HAL_I2C_InitDevice(HAL_I2C_INIT_DEFAULT, I2C_MASTER_CLK_SRC, NTAG_I2C_MASTER_BASEADDR); SystemCoreClockUpdate(); /* Initialize the NTAG I2C components */ ntag_handle = NFC_InitDevice((NTAG_ID_T)0, NTAG_I2C_MASTER_BASEADDR); // HAL_ISR_RegisterCallback((ISR_SOURCE_T)0, ISR_LEVEL_LO, NULL, NULL); #endif // NTAG_I2C‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ In ApplMain.c add the following under Public memory declarations /************************************************************************************ ************************************************************************************* * Public memory declarations ************************************************************************************* ************************************************************************************/ ... #ifdef NTAG_I2C NFC_HANDLE_T ntag_handle; // NTAG handle #endif // NTAG_I2C‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Include new headers to the following: In ApplMain.c include the following  #ifdef NTAG_I2C /* NTAG middleware module */ #include "HAL_I2C_driver.h" //#include "HAL_I2C_kinetis_fsl.h" #include <app_ntag.h> #endif //NTAG_I2C‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ In hid_device.c include the following #ifdef NTAG_I2C /* NTAG handler */ #include <app_ntag.h> #endif // NTAG_I2C‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Copy app_ntag.c and app_ntag.h files from KW41Z  workspace to KW36's. The app_ntag.c source file contains sample functions for working with NDEF messages. Function NFC_MsgWrite() creates and writes the NDEF message in the Type-2 Tag format to the NTAG I2C chip through the ntag_i2c_plus middleware. The write algorithm is NFC-Forum compliance. Function NDEF_Pairing_Write() contains a procedure to create a BTSSP record via using the NDEF library. The same is performing function NDEF_Demo_Write() function. Here is shown how to create NDEF multi-record that contains several types of NDEF records. The app_ntag.h header file contains predefined blocks of constants (constant fields of data) that are written to the NTAG I2C chip by default during the communication which requires set the default content to the chip’s registers or erase the NTAG I2C chip user memory and registers of lock bytes. NOTE: Please change the I²C Master base address and I²C Master clock source from I2C1 to I2C0 as below in app_ntag.h: In hid_device.c make the implementation in BleApp_HandleKeys() as below. This is an extension for BLE pairing and writing NDEF messages to NTAG I²C. void BleApp_HandleKeys(key_event_t events) { #ifdef NTAG_I2C uint32_t timeout = NDEF_WRITE_TIMEOUT; // static uint8_t boApplStart = TRUE; switch (events) { case gKBD_EventPressPB1_c: // short press of SW4 { // if (boApplStart) // { /* first time startup */ BleApp_Start(); // boApplStart = FALSE; // } // boNDEFState = TRUE; // pairing via NDEF is allowed in case the apk. is running TurnOffLeds(); /* added to copy the pairing NDEF message to NTAG_I2C chip */ if (NDEF_Demo_Write()) { // report an error during creating and writing the NDEF message LED_RED_ON; } else { // indication of success by orange color on the RGB LED LED_RED_ON; LED_GREEN_ON; } /* Start advertising timer */ TMR_StartLowPowerTimer( mNDEFTimerId, gTmrLowPowerSecondTimer_c, TmrSeconds(timeout), NDEFTimerCallback, NULL); break; } case gKBD_EventPressPB2_c: // short press of SW3 { TurnOffLeds(); /* added to copy the pairing NDEF message to NTAG_I2C chip */ if (NDEF_Pairing_Write()) { // report an error during creating and writing the NDEF message LED_RED_ON; } else { // indication of success by green color on the RGB LED LED_GREEN_ON; } /* Start advertising timer */ TMR_StartLowPowerTimer( mNDEFTimerId, gTmrLowPowerSecondTimer_c, TmrSeconds(timeout), NDEFTimerCallback, NULL); break; } case gKBD_EventLongPB1_c: // long press of SW4 { if (mPeerDeviceId != gInvalidDeviceId_c) { Gap_Disconnect(mPeerDeviceId); boNDEFState = FALSE; } break; } case gKBD_EventLongPB2_c: // long press of SW3 { #if gAppUsePrivacy_d if( mAdvState.advOn ) { mAppPrivacyChangeReq = reqOff_c; /* Stop Advertising Timer*/ TMR_StopTimer(mAdvTimerId); Gap_StopAdvertising(); } else if( gBleSuccess_c == BleConnManager_DisablePrivacy() ) { TMR_StartLowPowerTimer(mPrivacyDisableTimerId, gTmrLowPowerSingleShotMillisTimer_c, TmrSeconds(mPrivacyDisableDurationSec_c), PrivacyEnableTimerCallback, NULL); } #endif break; } default: break; } #else // NTAG_I2C switch (events) { case gKBD_EventPressPB1_c: { BleApp_Start(); break; } case gKBD_EventPressPB2_c: { hidProtocolMode_t protocolMode; /* Toggle Protocol Mode */ Hid_GetProtocolMode(service_hid, &protocolMode); protocolMode = (protocolMode == gHid_BootProtocolMode_c)?gHid_ReportProtocolMode_c:gHid_BootProtocolMode_c; Hid_SetProtocolMode(service_hid, protocolMode); break; } case gKBD_EventLongPB1_c: { if (mPeerDeviceId != gInvalidDeviceId_c) Gap_Disconnect(mPeerDeviceId); break; } case gKBD_EventLongPB2_c: { #if gAppUsePrivacy_d if( mAdvState.advOn ) { mAppPrivacyChangeReq = reqOff_c; /* Stop Advertising Timer*/ TMR_StopTimer(mAdvTimerId); Gap_StopAdvertising(); } else if( gBleSuccess_c == BleConnManager_DisablePrivacy() ) { TMR_StartLowPowerTimer(mPrivacyDisableTimerId, gTmrLowPowerSingleShotMillisTimer_c, TmrSeconds(mPrivacyDisableDurationSec_c), PrivacyEnableTimerCallback, NULL); } #endif break; } default: break; } #endif //NTAG_I2C }‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Add the declaration of the timer handler in Private memory declarations section of hid_device.c  /************************************************************************************ ************************************************************************************* * Private memory declarations ************************************************************************************* ************************************************************************************/ ... #ifdef NTAG_I2C static tmrTimerID_t mNDEFTimerId; static bool boNDEFState = FALSE; #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Add the declaration of the timer callback function in Private functions prototypes of hid_device.c /************************************************************************************ ************************************************************************************* * Private functions prototypes ************************************************************************************* ************************************************************************************/ ... #ifdef NTAG_I2C static void NDEFTimerCallback(void *); #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Allocate / Initialize the timer There are 3 timers used within the HID_device demo application. The NDEF timer is also necessary to allocate in the function BleApp_Config() in the hid_device.c file, at the same place as the common timers are allocated. Function TMR_AllocateTimer() returns timer ID value which is stored in the variable mNDEFTimerId. The timer ID allocation must be added behind the other timer as it is done at following C-code printout /* Allocate application timers */ mAdvTimerId = TMR_AllocateTimer(); mHidDemoTimerId = TMR_AllocateTimer(); mBatteryMeasurementTimerId = TMR_AllocateTimer(); #ifdef NTAG_I2C mNDEFTimerId = TMR_AllocateTimer(); #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Add the timer callback function It is necessary to add the NDEFTimerCallback() function at the end of the hid_device.c file. If NDEF timer counter expires timer is stopped. Then RGB LED is switched off. There is the printout of the call back function at the following lines. #ifdef NTAG_I2C /*! ********************************************************************************* * \brief Handles timer callback for writing NDEF messages * * \param[in] pParam Calback parameters. ********************************************************************************** */ static void NDEFTimerCallback(void * pParam) { /* Stop Advertising Timer*/ TMR_StopTimer(mNDEFTimerId); /* switch off the LED indication */ TurnOffLeds(); } #endif // NTAG_I2C‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Note: Change the size for timer task  in app_preinclude.h file as follows: /* Defines Size for Timer Task*/ #ifdef NTAG_I2C #define gTmrTaskStackSize_c 1024 // changed for the NTAG integration #else #define gTmrTaskStackSize_c 500 #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ Security change The sample project for adding NTAG I2C middleware is hid_device and is described in chapter 3.1.1. This project requires to enter the password “999999” during the Bluetooth pairing. From this reason is necessary to decrease the security level to remove the password sequence. Security level is a part of the configuration and is set in the app_config.c file. In this file following parameter must be changed gSecurityMode_1_Level_3_c to the new parameter: gSecurityMode_1_Level_1_c Parameter gSecurityMode_1_Level_3_c is used on several places within the app_config.c file. Use the FIND function (short key is “CTRL+F”) of the IDE to find it and update. There are last two parameters of the gPairingParameters structure which are necessary to change. parameter: .securityModeAndLevel = gSecurityMode_1_Level_3_c, has to be changed to: .securityModeAndLevel = gSecurityMode_1_Level_1_c, parameter: .localIoCapabilities = gIoDisplayOnly_c, has to be changed to: .localIoCapabilities = gIoNone_c, parameter .leSecureConnectionSupported = TRUE, has to be changed to: .leSecureConnectionSupported = FALSE, Symbols Add the following symbols to project settings -> Preprocessor. The ones in red are for integration of ntag_i2c_plus middleware and the one in green is for adding the NDEF library, please see below: Include paths Please add the following includes in project settings. The ones in red are for NTAG I²C Plus middleware and the ones in green for the NDEF Library, please see below: With the previous setup it shall be able to run Bluetooth pairing example as for FRDM-KW41Z. Hope this  helps!
View full article
Introduction I am trying to make one page that contain all the useful information about NFC Antenna Design. I will keep update and add the information to this page when I found something useful.   Training First of all, there are 6 webinars about NFC Antenna Design. It is a good training before to start your antenna design for NFC. Training & Events | NXP  (Search "Antenna design")   Application Notes AN11740 : PN5180 Antenna design guide AN11706 : PN7462AU Antenna design guide AN11019 : CLRC663, MFRC630, MFRC631, SLRC610 Antenna Design Guide AN11755 : PN7150 Antenna Design and Matching Guide AN11564 : PN7120 Antenna Design and Matching Guide AN11741 : How to design an antenna with DPC AN11535 : Measurement and tuning of a NFC and Reader IC antenna with a MiniVNA Tools NFC Antenna Design Hub
View full article
Hello NFC community:   NXP released the new PN7150 NFC Controller chip with enhanced power output, and there is also the new Arduino compatible demokit OM5578/PN7150ARD. See more information in the next pages:   PN7150: High performance full NFC Forum-compliant controlle|NXP OM5578/PN7150ARD: Demoboards for PN7150|NXP   There is also a new PN7120 SBC kit for arduino:   http://cache.nxp.com/documents/user_manual/UM11008.pdf http://cache.nxp.com/documents/user_manual/UM11008.pdf   Due to the Arduino interface pinout, these kits can also be used with Kinetis Freedom Boards. The target of this document is to create projects to use the NFC Controller lîbrary with the PN7120 or PN7150 together with a Kinetis host. Also you will find example projects created for the FRDM-K64F and FRDM-KL43Z.     Requirements:   - Kinetis Software Development Kit v1.3. -> Software Development Kit for Kinetis MCUs|NXP - KDS v3.x with KSDK v1.3 Eclipse Update Installed -> Kinetis Design Studio Integrated Development Enviro|NXP - Kinetis SDK project generator. Available from the "Downloads" tab of KSDK webpage -> Software Development Kit for Kinetis MCUs|NXP     CREATING NEW PROJECT   NOTE: In this step-by-step procedure the FRDM-K64F is used as reference. You can follow the guide according to your own Freedom board.   1) Open the KSDK project generator. 2) Enter the KSDK v1.3 installation path, give a name to the project, select your Freedom board and click on "Advanced":     3) In the advanced settings window enable the checkboxes for:   - Include BSP files - Generate standalone project - Kinetis Design Studio toolchain - Board (confirm that your board is shown in the drop-down menu)   NOTE: The path for the newly created project is set by default inside of the KSDK v1.3 installation. For a standalone project you can change the location, just remember such path to import the project to KDS workspace in a later step.   Leave the rest of configurations as default (New project, Platform library, no RTOS) and finally click on "Advanced Generate!".     4) From Kinetis Design Studio go to File -> Import.     5) Go to General -> Existing Projects into workspace and click "Next".     6) In "select root directory" browse to the location of the platform lib for the created project. By default this path would be:   C:\nxp\KSDK_1.3.0\examples\frdmk64f\user_apps\<project_name>\lib\ksdk_platform_lib\kds\<MCU>   <project_name>: The name given initially to the project. <MCU>: The corresponding device number (K64F12 in this case).   Make sure that the project check box is enabled and click on "Finish".     7) Select the KSDK platform library project and click on the "Hammer icon" to build it.     😎 Repeat steps 4 through 6, but this time browse to the location of the application project. In this example the path is:   C:\nxp\KSDK_1.3.0\examples\frdmk64f\user_apps\< project_name >\kds     INTEGRATING NFC CONTROLLER LIBRARY   The next steps describe how to integrate the NFC NCI library to your newly created project.   - The Arduino Interface Boards use the next pinout for communication between the OM5578/PN7150 or OM5577/PN7120 kits with the Freedom or Arduino boards:     As shown in the picture, the pinouts are similar except for the 5V connection. This leverages the enhanced output power feature of the PN7150 NFC Controller.   - We need to check the corresponding pins that will be used from the Freedom board. In this case, the connections to the FRDM-K64F board would be as next:   IMPORTANT: The pinout shown below corresponds to Rev E3 schematics of FRDM-K64F. For Rev D1 the pin used for IRQ (header location J2[2]) must be PTA0 instead of PTC12.     1) Open the file gpio_pins.c and add 2 pin configurations: 1 input pin called NFCCirqPin and 1 output pin called NFCCvenPin.   gpio_input_pin_user_config_t NFCCirqPin = {   .pinName = kGpioNFCCirq,   .config.isPullEnable = false,   .config.pullSelect = kPortPullUp,   .config.isPassiveFilterEnabled = false,   .config.interrupt = kPortIntDisabled, }; gpio_output_pin_user_config_t NFCCvenPin = {   .pinName = kGpioNFCCven,   .config.outputLogic = 1,   .config.slewRate = kPortSlowSlewRate,   .config.driveStrength = kPortLowDriveStrength, };   2) In the file gpio_pins.h add 2 extra elements to the gpio enumeration. Also add extern declarations for the 2 pins defined in the previous step.   NOTE: For FRDM-K64F the pins are PTC12 and PTC3. Select corresponding pins for your Freedom board.   extern gpio_input_pin_user_config_t NFCCirqPin; extern gpio_output_pin_user_config_t NFCCvenPin; /*! @brief Pin names */ enum _gpio_pins_pinNames {   kGpioSW2  = GPIO_MAKE_PIN(GPIOC_IDX, 6U),   kGpioSW3  = GPIO_MAKE_PIN(GPIOA_IDX, 4U),   kGpioSdhc0Cd  = GPIO_MAKE_PIN(GPIOE_IDX, 6U),   kGpioLED1     = GPIO_MAKE_PIN(GPIOE_IDX, 26U),   kGpioLED2     = GPIO_MAKE_PIN(GPIOB_IDX, 22U),   kGpioLED3     = GPIO_MAKE_PIN(GPIOB_IDX, 21U),   kGpioNFCCirq  = GPIO_MAKE_PIN(GPIOC_IDX,  12), /* GPIO for NFCC IRQ pin */   kGpioNFCCven  = GPIO_MAKE_PIN(GPIOC_IDX,  3),  /* GPIO for NFCC VEN pin */ }   3) In the file pin_mux.c define a function to configure the MUX setting of the required GPIO and I2C pins to interface with the NFC Controller.   void configure_nfcc_pins(void) {   /** I2C_SDA **/   PORT_HAL_SetMuxMode(PORTE,25u,kPortMuxAlt5);   PORT_HAL_SetOpenDrainCmd(PORTE,25u,true);   /** I2C_SCL **/   PORT_HAL_SetMuxMode(PORTE,24u,kPortMuxAlt5);   PORT_HAL_SetOpenDrainCmd(PORTE,24u,true);   /* NFCC IRQ */   PORT_HAL_SetMuxMode(PORTC,12u,kPortMuxAsGpio);   /* NFCC VEN */   PORT_HAL_SetMuxMode(PORTC,3u,kPortMuxAsGpio); }   NOTES: - Check the corresponding pins on your Freedom board. FRDM-K64F uses PTC12/PTC3 as GPIOs while PTE24/PTE25 are configured as I2C pins. For I2C pins also check the MUX number in the device's Reference Manual (e.g. PTE24/PTE25 in K64F have the I2C function in ALT5). - This function needs to be called from your project to configure the required pins. e.g. from hardware_init(). - Some Freedom boards share the I2C pins of the Arduino compatible header with an on-board I2C device (e.g. accelerometer), with SDA/SCL pull-up resistors populated already. If this is not the case for your board, make sure to place external pull-ups to  MCU VDD or enable the internal pull-ups as temporary workaround.   4) Add the prototype of the function to the header file pin_mux.h.   /* ** =================================================== **     Method :  configure_nfcc_pins */ /*! **     @brief **         Set mux configuration for I2C and GPIO pins **         to interface with the NFC Controller. */ /* ==================================================*/ void configure_nfcc_pins(void);   5) Copy the folders NfcLibrary and TML to the project folder. The file fsl_i2c_irq.c is also required. In this case the file is found in the next path:   C:\nxp\KSDK_1.3.0\examples\frdmk64f\user_apps\<project_name>\platform\drivers\src\i2c   NOTE: If the project was not created in standalone mode, just search the fsl_i2c_irq.c file from your KSDK installation.       6) Add the NfcLibrary and TML folders with all its subfolders and files to the project's tree, so the lilbrary is part of the build. Also add the file fsl_i2c_irq.c to the project. In KDS you can drag and drop folders and files to the project explorer view.       7) Add the compiler include paths for the inc folders.     😎 From the KDS preprocessor settings add or remove the next conditional compilation macros according to your functional requirements:   CARDEMU_SUPPORT: The NFC Controler host (MCU) can emulate a contactless card which can be accessed by an external Reader/Writer. P2P_SUPPORT: The host MCU can establish a 2-way communication accesing to or sending data to an external Reader/Writer. RW_SUPPORT: With this mode the host can access a remote contactless tag/card via the NFC Controller. NCI-DEBUG: If defined, all information transferred between the host MCU and the NFC Controller Interface (commands, responses, notifications, data) is echoed to console for debug purposes.     9) The file tml.h includes the macro NFCC_I2C_INSTANCE which defines the I2C module to use. For FRDM-K64F the module is I2C0. Set this macro according to your Freedom board.   /* NFC Controller I2C interface configuration */ #define NFCC_I2C_INSTANCE  0   At this point the project is ready to use the NFC Controller library and interface the Kinetis Freedom board with PN7120 or PN7150 NFC Controllers.     DEMO PROJECTS   At the end of this document you will find 2 example project packages for the FRDM-K64F and FRDM-KL43Z. Both of the projects can be used with either the OM5578/PN7150 or OM5577/PN7120 kits using the Arduino interface boards.   Each ZIP package includes 2 projects (example application and KSDK library). Unzip the package and import the projects from the resulting location.   Do not select "Copy projects into workspace" in KDS. If you do so the build will fail due to the linked source files not copied over.   The projects must be built in the next order:   1- Platform library project (FRDM-xxx_NFCNCI_Example\lib\ksdk_platform_lib\kds\<MCU>) 2- Demo project (FRDM-xxx_NFCNCI_Example\kds)   The OpenSDA virtual COM port is used to send data to a terminal at 115200 baud. Below an explanation on how to test the different project example features.   RW mode:   - Placing a tag with a single text, URI or vCard NDEF record next to the NFC reader antenna. Examples:         P2P mode:   - Bring an android phone with NFC enabled close to the NFC controller antenna and use the "beaming" feature. In the case below the NXP home page is "beamed" from the adroid phone's explorer. After this, the NFC enabled phone will receive the "Test" NDEF record.                     CARD EMULATION mode     For this mode it is required to remove the P2P_SUPPORT macro and rebuild/reprogram the project.   - Bringing an android phone set to read a NFC tag close to the NFC controller board. The NFC enabled phone will detecta T4T tag type with the "Test" NDEF record.     I hope you can find this document useful. Any questions or doubts please let me know in the comments.   Jorge Gonzalez NXP Technical Support
View full article
This is a step by step guide on setting up and running a simple NFC Demo App using the PN7150 NFC Controller SBC Kit for Arduino (OM5578/PN7150ARD) with a UDOO NEO board which uses an i.MX6SX and it's Arduino pin compatible. 1. Requirements - UDOO NEO board. This document refers to the UDOO NEO Full board, but the steps remain the same for all UDOO Neo boards as long as the appropriate Device Tree is used for each. For more information on this board please go to the official site (http://www.udoo.org/) UDOO Neo Full Board - PN7150 NFC Controller SBC Kit for Arduino (OM5578/PN7150ARD) which is shown on the image below. Alternatively you may use the PN7120 NFC Controller SBC Kit for Arduino (OM5577/PN7120ARD). PN7150 NFC Controller SBC Kit for Arduino mounted over the UDOO Neo You may find more details about the OM5578 board on the user manual (Doc ID UM10935) which is available on the following link. http://www.nxp.com/documents/user_manual/UM10935.pdf You may also find additional documentation and information of this and other PN7150 demoboards on the link below: Demoboards for PN7150|NXP​ You may find more details about the OM5577 board on the user manual (Doc ID UM10878) which is available on the following link. http://www.nxp.com/documents/user_manual/UM10878.pdf For additional resources for the OM5577 board please refer to the link below. PN7120 NFC Controller SBC Kit|NXP - Host computer with Ubuntu 12.04 or later (14.04 is preferred). - L3.14.28 BSP Release for the i.MX6SX installed on the host. You may find the documentation on how to download and setup this BSP on the following link. http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/i.mx-applications-processors/embedded-linux-for-i.mx-applications-processors:IMXLINUX?code=IMXLINUX 2. Setting up NXP BSP Release and Toolchain Follow the instructions on the Yocto User’s Guide included on the L3.14.28 BSP Release to setup and build an image to for the i.MX6SX (MACHINE= imx6sxsabresd). We’ll be using the fsl-image-gui image with frame buffer (fb) backend. Other images may be used but please keep in mind that the core-image-minimal image does not include the libstdc++.so.6 library required by the NFC Demo App. It is also necessary to build and install the toolchain for cross compiling the kernel and bootloader. This can be done with the following command: $ bitbake meta-toolchain Once created you may install it by running the following script: <BSP_DIR>/<BUILD_DIR>/tmp/deploy/sdk/poky-glibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.7.sh For more details on how to extract the toolchain please refer to the following Yocto Training Task: Task #7 - Create the toolchain 3. Editing the Device Tree In previous versions (3.0.35 backward) the Linux Kernel used to contain the entire description of the hardware so the bootloader just had to load the kernel image and execute it. In current Kernel versions the hardware description is located in the device tree blob (DTB), which allows for the same Kernel to be used in different Hardware by changing only the Device Tree. In this scenario the bootloader loads the Kernel image and also the Device Tree (DTB) binary. For more details on how to add a new Device Tree please look at the following Community Document that covers adding a new device tree: https://community.nxp.com/docs/DOC-329664 For this document we will change the current UDOO NEO Device Tree as we will only be adding support for the PN7150 NFC Controller Board. 3.1 Copying the original UDOO Neo Device Tree files Create a development folder in your home directory. mkdir udooneo-dev Download the kernel source into this folder. This also includes the device tree files. cd udooneo-dev git clone https://github.com/UDOOboard/linux_kernel The Device Tree files will be available at  udooneo-dev/linux_kernel/arch/arm/boot/dts 3.2. Editing the UDOO Neo Device Tree Files We will be using the UDOO Neo Full board, so we will be using the imx6sx-udoo-neo-full-hdmi-m4.dts. If we look into this file using a text editor we will see that it includes several include definition files which are also located in the same directory. #include "imx6sx-udoo-neo.dtsi" #include "imx6sx-udoo-neo-full.dtsi" #include "imx6sx-udoo-neo-m4.dtsi" #include "imx6sx-udoo-neo-hdmi.dtsi" #include "imx6sx-udoo-neo-externalpins.dtsi" We will need to copy these to the BSP Release dts directory (you may alternatively build the device tree from this directory, but we will cover how to add device trees to the BSP Release in this document): /<BSP_DIR>/<BUILD_DIR>/tmp/work/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/arch/arm/boot/dts/ We will need to add the new dtb file to be compiled on the Makefile from the BSP Release.  This needs to be placed inside the precompiler directive $(CONFIG_ARCH_MXC) There are some additions that must be made to device tree in order to configure the pins used by the NFC controller Board which uses the Arduino Pinout. These can be done to the imx6sx-udoo-neo.dtsi so they are taken by any UDOO Neo Device Tree we compile. The I2C pins used are those of the I2C2 bus. The configuration for these pins should be already implemented on the imx6sx-udoo-neo.dtsi file. If not please add these lines inside the &iomuxc section. &iomuxc {                         pinctrl_i2c2_1: i2c2grp-1 {                                         fsl,pins = <                                                         MX6SX_PAD_GPIO1_IO03__I2C2_SDA          0x4001b8b1                                                         MX6SX_PAD_GPIO1_IO02__I2C2_SCL           0x4001b8b1                                         >;                       }; }; Then we need to add the pn547 entry into the &i2c2 section for the enable pin, interrupt pin, I2C address and buss speed for the PN7150. Put what is in bold below at the end of the “&i2c2” section as shown. &i2c2 { pn547: pn547@28 { compatible = "nxp,pn547";                 reg = <0x28>; clock-frequency = <400000>; interrupt-gpios = <&gpio4 9 0>; enable-gpios = <&gpio5 21 0>;         }; }; Important Note: Prior to adding either of these configurations it is critical that you ensure these pins and I2C addresses are not used anywhere else in this and other *udo*.dtsi files You may find the UDOO Neo Schematics on the UDDO website (link to the schematics below) to see the reason behind these settings. http://www.udoo.org/download/files/schematics/UDOO_NEO_schematics.pdf IR Signal – J4 Connector – Arduino 7 pin – i.MX6SX B13 pin VEN Signal - J6 Connector – Arduino 8 pin - i.MX6SX W5 pin SDA Signal – J6 Connector – Arduino SDA pin - i.MX6SX D20 pin SCL Signal – J6 Connector – Arduino SCL pin - i.MX6SX C20 pin If you want to review in more detail how to create a simple Device Tree from scratch please check the following very complete and easy to follow Community Document. Basic Device Tree for the Udoo Board To compile the device tree run the following command source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi cd /<BSP_DIR>/<BUILD_DIR>/tmp/work/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git make ARCH=arm dtbs This will produce the Imx6sx-udoo-neo-full-hdmi-m4.dtb that will be used. 4. Compiling U-Boot We will be using the UDOO U-boot for the UDOO Neo Full board. The following steps describe how to download the source code and compiling it using our toolchain. Downloading the source code mkdir UDOOneo-dev cd UDOOneo-dev git clone -b 2015.04.imx-neo https://github.com/UDOOboard/uboot-imx cd uboot-imx Compiling u-boot source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- make udoo_neo_config ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- make This will generate a SLP file with the DCD (Device Configuration Data) table and the u-boot.img file. Note: By default this U-Boot configuration detects the UDOO Neo board and in our case it would look for the imx6sx-udoo-neo-full-hdmi-m4.dtb. You may need to use a different device tree depending on your board. 5. Flashing SD Card 5.1. Using the .sdcard file to load the BSP Release Image The easiest way to load the Root File System from our image is using the .sdcard file that is created after running bitbake. This image will be located on the following path: /<BSP_DIR>/<BUILD_DIR>/tmp/deploy/images/imx6sxsabresd This will also load the BSP Release U-boot and device tree files but we will then exchange for our own. To do this use the following command where sdx is your SD Card. $ sudo dd if=<image name>.sdcard of=/dev/sdx bs=1M && sync Alternatively we can manually create the two partitions needed. For more information on this please refer to the Yocto User’s Guide. 5.2. Writing U-boot To flash U-boot you need to flash both the SPL file and the u-boot.img file using the following commands assuming that your SD card is in /dev/sdx dd if=SPL of=/dev/sdx bs=1K seek=1 dd if=u-boot.img of=/dev/sdx bs=1K seek=69 5.3. Copying the Device Tree Blob Copy the imx6sx-udoo-neo-full-hdmi-m4.dtb device tree to a folder called dts on the FAT partition. 6. Adding Kernel Driver Download the driver source from the git repository from the Linux source directory cd /<BSP_DIR>/<BUILD_DIR>/tmp/work/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/drivers/misc $ git clone https://github.com/NXPNFCLinux/nxp-pn5xx.git Add the line below to the Makefile of the current directory     obj-y += nxp-pn5xx/ Include the driver config by adding below line to the heading configuration file (drivers/misc/Kconfig). source "drivers/misc/nxp-pn5xx/Kconfig" Export the environment variables cd /<BSP_DIR>/<BUILD_DIR>/tmp/work/imx6sxsabresd-poky-linux-gnueabi/linux-imx/3.14.28-r0/git/     $ source /opt/poky/1.7/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi     $ export ARCH=arm     $ export CROSS_COMPILE=$TARGET_PREFIX     $ make imx_v7_defconfig make menuconfig Inside menu config include the driver as a module (<M>), which is on the path: Device Drivers --->       Misc devices --->     < M> NXP PN5XX based driver Save the changes and exit, and then compile the modules. $ make modules We will then install the modules to our image. Insert the SD card with the loaded image and mount it to access it from the command promt. sudo mount /dev/sdx ~/mountpoint/ Where sdx is your SD card. Then use the following command to install the modules. sudo ARCH=arm INSTALL_MOD_PATH=/home/user/mountpoint modules_install firmware_install Before unmounting our SD card we will install the NFC library. 7.Installing the NFC library. Install the necessary libraries on the host by running the following commands: sudo apt-get update sudo apt-get install automake sudo apt-get install autoconf sudo apt-get install libtool Note: In case you are using Ubuntu 12.04 the following commands will allow for autoconf 2.69 to be installed, which is the minimum version required by the NFC library. sudo add-apt-repository ppa:dns/gnu -y sudo apt-get update -q sudo apt-get install --only-upgrade autoconf Enter our directory and install the Linux libnfc-nci stack cd ~/UDOOneo-dev git clone https://github.com/NXPNFCLinux/linux_libnfc-nci.git Generate the configuration script by executing the bootstrap bash script cd ~/UDOOneo-dev/linux_libnfc-nci ./bootstrap Configure Make file. We are using the default toolchain sysroots path. To configure for the PN7150 please use the following settings: ./configure --enable-pn7150 --host=arm-none-linux --prefix=/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr --sysconfdir=/home/user/mountpoint/etc To configure for the PN7120 please use the following settings: ./configure --enable-pn7120 --host=arm-none-linux --prefix=/opt/poky/1.7/sysroots/x86_64-pokysdk-linux/usr --sysconfdir=/home/user/mountpoint/etc We are ready to execute the make and install the stack. make sudo make install After a successful build the libraries and a application demo are built in .libs directory. Copy the libraries to “/usr/lib” directory of the target and nfcDemoApp to the targets “/usr/sbin” cd .libs sudo cp * /home/user/mountpoint/usr/lib sudo cp nfcDemoApp /home/user/mountpoint/usr/sbin cd ~/UDOOneo-dev/linux_libnfc-nci/conf/PN7150 sudo cp * /home/user/mountpoint/etc Now we can unmount our SD card. sudo umount /home/user/mountpoint 8. Testing the NFC Reader Insert the micro SD card into the slot of the UDOO Neo board and install the PN1750 NFC Controller board on top of the UDOO Neo board. We will be using the terminal console in order to access the board. You may use the official USB/Serial debug module for NEO or a similar adapter. For more information on setting up the Serial Debug Console on the UDOO Neo board please refer to the link below. http://www.udoo.org/docs-neo/Basic_Setup/Serial_Debug_Console.html Once it has booted, install the .ko file. insmod /lib/modules/3.14.28+g91cf351/kernel/drivers/misc/nxp-pn5xx/pn5xx_i2c.ko Then run the nfcDemoApp. We’ll test it in poll mode, where it looks for available tags and reads them. nfcDemoApp poll You should get a console output as shown below when placing a NFC tag next to the NFC reader. Appendix. References and useful documents http://www.nxp.com/documents/application_note/AN11697.pdf Demoboards for PN7150|NXP PN7120 NFC Controller SBC Kit|NXP NFC PN7120 on the  i.MX6Q | NXP Community Basic Device Tree for the Udoo Board Basic Device Tree for the Udoo Board U-Boot Migration Example http://www.nxp.com/documents/user_manual/UM10935.pdf
View full article
Hardware: 1. i.MX6ULL EVK board   2. OM27160A1HN   Software: 1. Build the Yocto Linux BSP for i.MX6ULL EVK. Here are the steps: $ mkdir L6.6.36_2.1.0 $ cd L6.6.36_2.1.0 $ repo init -u https://github.com/nxp-imx/imx-manifest -b imx-linux-scarthgap -m imx-6.6.36-2.1.0.xml $ repo sync   $ DISTRO=fsl-imx-xwayland MACHINE=imx6ull14x14evk source imx-setup-release.sh -b build-for-6ullevk $ bitbake core-image-full-cmdline   2. Add the nxpnfc driver to kernel After the BSP build succeed, the kernel source code is located here: L6.6.36_2.1.0/build-for-6ullevk/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/linux-imx/6.6.36+git/git/   Clone the nxpnfc repository into the kernel directory, replacing existing implementation: $ cd L6.6.36_2.1.0/build-for-6ullevk/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/linux-imx/6.6.36+git/git/ $ rm -rf drivers/nfc $ git clone https://github.com/NXPNFCLinux/nxpnfc.git drivers/nfc  This will end-up with the folder drivers/nfc containing the following files: • README.md: repository information • Makefile: driver heading makefile • Kconfig: driver configuration file • LICENSE: driver licensing terms • i2c_devicetree.txt: example of I²C device tree definition • spi_devicetree.txt: example of SPI device tree definition • nfc sub folder containing: – Makefile: – common.c: generic driver implementation – common.h: generic driver interface definition – i2c.c: I2C specific driver implementation – i2c.h: I2C specific driver interface definition – spi.c: SPI-specific driver implementation – spi.h: SPI-specific driver interface definition   Through kernel menuconfig procedure include the targeted driver to the build, as built-in (<*>): $ bitbake linux-imx -c menuconfig <*> NFC I2C Slave driver for NXP-NFCC       3. Connection between i.MX6ULL EVK and the PN7160 There are some pins on the Arduino header on the i.MX6ULL EVK board can be used to connect the PN7160 board. Below is the schematic of the Arduino headers on the i.MX6ULL EVK board. The two I2C2 pins can be used for I2C connection. The UART2_RX, UART2_TX and UART2_RTS can be changed to GPIO for connecting IRQ, VEN and DWL_REQ of PN7160. Below is the J1704 and J1703 on the EVK board.   Below is the schematic of Arduino interface on OM27160A1HN. There is a connector board (OM29110ARD-B). The OM27160A1HN is connecting on top of it. Below is the connectors board schematic. So, on the i.MX6ULL EVK board, we need I2C2 SDA and I2C2 SCL for I2C connections. And 3 GPIO pins for PN7160's IRQ, VEN and DWL_REQ. Here is the connection between i.MX6ULL EVK and OM29110ARD-B. OM29110ARD-B pin i.MX6ULL EVK pin I2C_SCL J2-1 I2C2_SCL J1704-10 I2C_SDA J2-2 I2C2_SDA J1704-9 GPIO_0 J2-10 GPIO1_21 J1703-1 GPIO_1 J4_1 GPIO1_20 J1703-2 GPIO_2 J4_2 GPIO1_25 J1703-3 3.3V J1-4 3.3V J1705-4 5V J1-5 5V J1705-5 GND J1-6 GND J1705-6      4. Modify the device tree file of i.MX6ull evk. The device tree file for i.MX6ULL evk is imx6ul-14x14-evk.dtsi. The location of the device tree file is here: L6.6.36_2.1.0/build-for-6ullevk/tmp/work/imx6ull14x14evk-poky-linux-gnueabi/linux-imx/6.6.36+git/git/arch/arm/boot/dts/nxp/imx/imx6ul-14x14-evk.dtsi   As we don't use the UART2, we disabled it. &uart2 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart2>; uart-has-rtscts; /* for DTE mode, add below change */ /* fsl,dte-mode; */ /* pinctrl-0 = <&pinctrl_uart2dte>; */ status = "disabled"; // <--- change the status to "disabled" bluetooth { compatible = "nxp,88w8987-bt"; }; };   Put the nxpnfc into the &I2C2 node. nxpnfc: nxpnfc@28 { compatible = "nxp,nxpnfc"; reg = <0x28>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_nfcgpio>; nxp,nxpnfc-irq = <&gpio1 21 0>; nxp,nxpnfc-ven = <&gpio1 20 0>; nxp,nxpnfc-fw-dwnld = <&gpio1 25 0>; };   Add the gpios for nxpnfc. pinctrl_nfcgpio: nfcgpiogrp { fsl,pins = < MX6UL_PAD_UART2_RX_DATA__GPIO1_IO21 0xb0 //irq MX6UL_PAD_UART2_TX_DATA__GPIO1_IO20 0xb0 //ven MX6UL_PAD_UART3_RX_DATA__GPIO1_IO25 0xb0 //dwld req >; };     5. Re-compile the kernel and the whole image. $ bitbake linux-imx -c compile $ bitbake core-image-full-cmdline     6. Using UUU to program the board. The built image is .wic.zst file. We need to program it to the board. It is located in the deploy folder below. L6.6.36_2.1.0/build-for-6ullevk/tmp/deploy/images/imx6ull14x14evk/core-image-full-cmdline-imx6ull14x14evk.rootfs-20241113103828.wic.zst   Download the UUU.exe from here: https://github.com/nxp-imx/mfgtools/releases   Download the Demo image for i.MX6ULL EVK from the Linux BSP web page.   Unzip the demo image file to a folder. And then copy the UUU.exe to the same demo image folder.   Connect the board to your PC using the USB cable. Switch the boot mode to "Serial Downloader mode"   On the PC side, run the below command to program the image to SD card on the i.MX6ULL EVK. uuu -b sd_all core-image-full-cmdline-imx6ull14x14evk.rootfs-20241112083235.wic.zst   Then switch the boot mode to "Internal Boot (Development)". Restart the board.   Then, follow the PN7160 Linux porting guide (in the Reference(2) below) Chapter 5 for NFC Library and Chapter 6 for nfcDemo App examples.   References: 1. i.MX Yocto Project User's guide 2. PN7160 Linux Porting Guide 3. MCIMX6ULL-EVK_DESIGNFILES 4. OM27160A1HN Hardware Design Files 5. OM29110 NFC’s SBC Interface Board Design Files
View full article
  Some customers are trying to update the user firmware on PN7642 through host interface and using “DownloadLibEx1” demo,  and they are using SFWUMaker to create .esfwu file from .bin followed the readme file but failed to do a firmware update. Here is a step-by-step guide to do it. I will use the SDK led blinky demo,  and generate an Esfwu file , and program it into PN7642 board with LPC5516 host.  Led blinky demo is in PN7642_MCUXpresso_SDK_02-15-00_PUB.  You can download it from PN7642 product page.  Single-Chip Solution with High-Performance NFC Reader, Customizable MCU and Security Toolbox | NXP Semiconductors Step 1: compile pnev7642fama_led_blinky demo Please make sure the flash size is 180KB.  By default,  the output flash size is 180KB with MCUXpresso IDE.     Step 2: Bin file generation The binary (.bin) file is not generated by default, we can do it manually by doing following: Build your target application Open the debug/release folder in MCUXpresso Right-click on the *.axf file Choose 'Binary Utilities' → 'Create binary' in the menu The .bin should appear   Step 3: Make an ESFWU file To convert a bin file to an ESFWU file, we can use the ESFWU Maker Utility (sw810311). It can be downloaded from PN7642 product page. It is a secure file, and you need to have an active NDA to get it.  To run this utility, the toml file is very important.  You need to change the output name and binary name according to your project ,  and  you need to use the correct aes_root_key. For other parameters, we left them unchanged.   3.1   change the output name and binary name   3.2 set the correct aes_root_key The application flashed via SWD is a bin file and NOT encrypted neither is it flashed with our bootloader. The .esfwu file via host interface is encrypted and flashed by our own bootloader.  The keys have to be valid, else the bootloader will not be able to decrypt the received file. Please make sure we are using the right keys to create the user application firmware.  This is crucial and without it, it won’t work anyways. The default keys are mentioned in the datasheet as transport keys. See below picture.  But it is highly recommended to provision your own keys!  Please have a look at the secure key mode application note for further information on that.        If you are not sure whether you have provisioned the root key or not, you can check the SKM state by running SKM demo. if the root key is provisioned, please use the provisioned root key.  From below picture, I can see that the app_root_key is  not provisioned, so I use the default transport key.     3.3  use the EsfwuMaker command to generate the Esfwu file.     After this command, we can get the esfwu file.       Step 4: Secure firmware download   We use the firmware download example to update the PN7642 firmware.  It is in the host software package, it  holds examples to be used with LPC55S16 and MCUXpresso, to interact with the PN7642. The LPC55S16 Host Software can be download from PN7642 product page. LPC55S16 Host Software Version 02.01.00 (nxp.com) To run the demo, we need to edit the firmware location.  In file DownloadLibEx1.c,  about line 60.       Please set the correct hardware settings as below.  we have to stack the PNEV7642A Rev-B development board on top of the LPC55S16-EVK board. Align Pin.1 of J36 of the PNEV7642A Rev-B development board with Pin.1 of J9 of the LPC55 board. The last 4 pins, 17 - 20, of J12 of the LPC board are not connected. As well as pin 1-4 of J10 stay unconnected, as below picture shows.       Run the firmware download Demo with LPC55s16,  see the log output below.  Choose option “6” to update your application firmware. The update may take a while.  At the end, a successful update is indicated by the prompt of “Successful firmware upload ”.         To verify it is successful, we can run this demo, please keep J65 open.  you will see the D7 (RED LED) blinky (0.5 HZ rate). If you need the pnev7642fama_led_blinky.esfwu, please let me know.    
View full article