NFC Knowledge Base

cancel
Showing results for 
Search instead for 
Did you mean: 

NFC Knowledge Base

Knowledge Base Articles

Hello NFC enthusiasts, The following topics will be covered in this document: Activation of multiple Tags. For more information, please refer to Activating multiple Tags using NFC Reader Library  Read and Write NDEF messages. Reading values from GPIOs. This document will be segmented into three parts: Description. Software configuration section. Hardware configuration section. Demonstration. Description. The purpose of this project is to copy the information stored from one tag to another by making use of GPIOs to decide which tag to copy from. This way, topics such as read and write NDEF, card activation and GPIOs will be implemented.   Software configuration section: This demonstration is based on NXP NFC Reader Library v05.02.00, NfcrdlibEx3_NFCForum project for PNEV7462B, in which some modifications are going to be made in order to carry this out. These tags are compliant with NFC Forum Type 2 Tag and ISO/IEC14443 Type A specifications.    In phacDiscLoop.h modify the max number of cards supported (two cards for this demonstration):   #define PHAC_DISCLOOP_CFG_MAX_CARDS_SUPPORTED 0x02U      In NfcrdlibEx3_NFCForum.c add the following code in  LoadDiscoveryConfiguration():   static phStatus_t LoadDiscoveryConfiguration ( ) { . . . /*Passive max typea devices*/ status = phacDiscLoop_SetConfig ( pDiscLoop , PHAC_DISCLOOP_CONFIG_TYPEA_DEVICE_LIMIT , 2 ) ; CHECK_STATUS ( status ) ; }   A fix to the SW stack has to be made (Fix will be implemented in the next release): open "phacDiscLoop_Sw_Int_A.c", line 511, change if statement as below.     if ( ( pDataParams -> sTypeATargetInfo . bTotalTagsFound > 1 ) && ( ( bTypeATagIdx ) < pDataParams -> sTypeATargetInfo . bTotalTagsFound ) )   In NfcrdlibEx3_NFCForum.c add #include "phhalGpio.h" to local headers section. /* Local headers */ #include <cards.h> #include "phhalGpio.h" #include "NfcrdlibEx3_NFCForum.h" ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ In  NfcrdlibEx3_NFCForum.c define uint16_t NDEFlength = 0 and declare void InitGPIOs(void) in Global Defines section. /******************************************************************************* **   Global Defines *******************************************************************************/ phacDiscLoop_Sw_DataParams_t       * pDiscLoop ;        /* Discovery loop component */ void * ppalI18092mPI ; void * ppalI18092mT ; void * palTop ; /* Variables and InitGPIOs() needed for this application */ uint8_t bTagState1 ; uint8_t * value ; uint8_t * value1 ; uint8_t val , val1 ; uint16_t NDEFlength = 0 ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍ void InitGPIOs ( void ) ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ in Main Function, initialize the following: /******************************************************************************* **   Main Function *******************************************************************************/ int main ( void ) {      /* Initialize section */      value = & val ;      value1 = & val1 ;      InitGPIOs ( ) ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ In case of multiple devices (which is of our interest) add the following code and comment the if(wNumberOfTags > 1){...} section as follows: else if ( ( status & PH_ERR_MASK ) == PHAC_DISCLOOP_MULTI_DEVICES_RESOLVED )             {                 /*                  * Multiple cards resolved. It enters here if DEVICE LIMIT > 1 and more than one devices are                  * detected and resolved.                  */                 DEBUG_PRINTF ( " \n Multiple cards resolved: \n" ) ;                 /* Get detected technology type */                 status = phacDiscLoop_GetConfig ( pDiscLoop , PHAC_DISCLOOP_CONFIG_TECH_DETECTED , & wTagsDetected ) ;                 CHECK_STATUS ( status ) ;                 /* Get number of tags detected */                 status = phacDiscLoop_GetConfig ( pDiscLoop , PHAC_DISCLOOP_CONFIG_NR_TAGS_FOUND , & wNumberOfTags ) ;                 CHECK_STATUS ( status ) ;                 DEBUG_PRINTF ( "\tNumber of tags: %d \n" , wNumberOfTags ) ;                 /* Tag 1 information */                 DEBUG_PRINTF ( "\n Tag 1 NDEF information: \n" ) ;                 status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x00 ) ;                 /* Check for NDEF presence */                 status = phalTop_CheckNdef ( palTop , & bTagState1 ) ;                 DEBUG_ERROR_PRINT ( status ) ;                 status = ReadNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ;                 DEBUG_ERROR_PRINT ( status ) ;                 /* Tag 2 information */                 DEBUG_PRINTF ( "\n Tag 2 NDEF information: \n" ) ;                 status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x01 ) ;                 /* Check for NDEF presence */                 status = phalTop_CheckNdef ( palTop , & bTagState1 ) ;                 DEBUG_ERROR_PRINT ( status ) ;                 status = ReadNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ;                 DEBUG_ERROR_PRINT ( status ) ;                 DEBUG_PRINTF ( " \n --------------------------------------------------------------------------------------- \n\n" ) ;                 DEBUG_PRINTF ( " \n Options: \n\n" ) ;                 DEBUG_PRINTF ( " \n 1.- Left button  -(X)-( )- To copy NDEF message from Tag 1 to Tag 2 \n\n" ) ;                 DEBUG_PRINTF ( " \n 2.- Right button -( )-(X)- To copy NDEF message from Tag 2 to Tag 1 \n\n" ) ;                 DEBUG_PRINTF ( " \n --------------------------------------------------------------------------------------- \n\n" ) ;                 /* Reading values from GPIOs 2 and 3 */                 do                 {                     phhalPcr_GetGpioVal ( 2 , value ) ;                     phhalPcr_GetGpioVal ( 3 , value1 ) ;                 } while ( * value == 1 && * value1 == 1 ) ;                 /* Copy NDEF content from tag at index 0 to Tag at index 1*/                 if ( * value == 0 && * value1 == 1 )                 {                      DEBUG_PRINTF ( " \n Copy NDEF from Tag 1 to Tag 2 \n" ) ;                 status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x00 ) ;                 /* Check for NDEF presence */                 status = phalTop_CheckNdef ( palTop , & bTagState1 ) ;                 DEBUG_ERROR_PRINT ( status ) ;                 status = ReadNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ;                 DEBUG_ERROR_PRINT ( status ) ;                 status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x01 ) ;                 /* Check for NDEF presence */                 status = phalTop_CheckNdef ( palTop , & bTagState1 ) ;                 DEBUG_ERROR_PRINT ( status ) ;                     if ( bTagState1 == PHAL_TOP_STATE_READWRITE )                     {                     status = WriteNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ;                     DEBUG_ERROR_PRINT ( status ) ;                     }                     DEBUG_PRINTF ( " \n NDEF from Tag 1 to Tag 2 already copied \n" ) ;                 }                 /* Copy NDEF content from tag at index 1 to Tag at index 0*/                 else if ( * value == 1 && * value1 == 0 )                 {                      DEBUG_PRINTF ( " \n Copy NDEF from Tag 2 to Tag 1 \n" ) ;                     /* Check for NDEF presence */                     status = phalTop_CheckNdef ( palTop , & bTagState1 ) ;                     status = ReadNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ;                     DEBUG_ERROR_PRINT ( status ) ;                     status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x00 ) ;                     /* Check for NDEF presence */                     status = phalTop_CheckNdef ( palTop , & bTagState1 ) ;                         if ( bTagState1 == PHAL_TOP_STATE_READWRITE )                         {                         status = WriteNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ;                         DEBUG_ERROR_PRINT ( status ) ;                         }                         DEBUG_PRINTF ( " \n NDEF from Tag 2 to Tag 1 already copied \n" ) ;                 }                 DEBUG_PRINTF ( " \n Please remove the tags \n\n" ) ;                 DEBUG_PRINTF ( " \n Press any button to continue... \n\n" ) ;                                 /* Reading values from GPIOs 2 and 3 */                 do                 {                     phhalPcr_GetGpioVal ( 2 , value ) ;                     phhalPcr_GetGpioVal ( 3 , value1 ) ;                 } while ( * value == 1 && * value1 == 1 ) ; /*                if(wNumberOfTags > 1)                 {                      Get 1st detected tag and activate device at index 0                     for(bIndex = 0; bIndex < PHAC_DISCLOOP_PASS_POLL_MAX_TECHS_SUPPORTED; bIndex++)                     {                         if(PHAC_DISCLOOP_CHECK_ANDMASK(wTagsDetected, (1 << bIndex)))                         {                             DEBUG_PRINTF("\t Activating device @ index 0\n");                             status = phacDiscLoop_ActivateCard(pDataParams, bIndex, 0);                             break;                         }                     }                     if( ((status & PH_ERR_MASK) == PHAC_DISCLOOP_DEVICE_ACTIVATED) ||                             ((status & PH_ERR_MASK) == PHAC_DISCLOOP_PASSIVE_TARGET_ACTIVATED))                     {                          Get detected technology type                         status = phacDiscLoop_GetConfig(pDiscLoop, PHAC_DISCLOOP_CONFIG_TECH_DETECTED, &wTagsDetected);                         CHECK_STATUS(status);                         GetTagInfo(pDataParams, 0x01, wTagsDetected);                         DEBUG_PRINTF("\t\t Activation successful\n");                     }                     else                     {                         DEBUG_PRINTF("\t\tCard activation failed\n");                     }                 }*/                 /* Switch to LISTEN mode if supported after POLL mode */             } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ In NfcrdlibEx3_NFCForum.h declare WriteNdefMessage(). /** * Write NDEF message to a detected tag. * */ phStatus_t WriteNdefMessage (     uint8_t TopTagType ) ;       /* [in] Tag type to which write NDEF */ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ In NfcrdlibEx3_NFCForum.c define the function WriteNdefMessage(). /** * Writes NDEF Message to a tag */ phStatus_t WriteNdefMessage ( uint8_t TopTagType ) {     phStatus_t status ;     uint8_t bTagState ;     uint16_t wDataLength = 0 ;     /* Configure Top layer for specified tag type */     status = phalTop_SetConfig ( palTop , PHAL_TOP_CONFIG_TAG_TYPE , TopTagType ) ;     DEBUG_ERROR_PRINT ( status ) ;     /* Check for NDEF presence */     status = phalTop_CheckNdef ( palTop , & bTagState ) ;     DEBUG_ERROR_PRINT ( status ) ;     if ( bTagState == PHAL_TOP_STATE_READWRITE )     {         /* Write NDEF message */         status = phalTop_WriteNdef ( palTop , baSnepAppBuffer , NDEFlength ) ;         DEBUG_ERROR_PRINT ( status ) ;         /* Print NDEF message, if not NULL NDEF */         if ( NDEFlength )         {             DEBUG_PRINTF ( "\tNDEF detected...\n" ) ;             DEBUG_PRINTF ( "\tNDEF length: %d\n" , wDataLength ) ;             DEBUG_PRINTF ( "\tNDEF message:\n" ) ;             //DumpBuffer(aData, wDataLength);             DumpBuffer ( baSnepAppBuffer , 50 ) ;         }         else         {             DEBUG_PRINTF ( "\tNDEF content is NULL...\n" ) ;         }     }     else     {         DEBUG_PRINTF ( "\tNo NDEF content detected...\n" ) ;     }     return status ; } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ In NfcrdlibEx3_NFCForum.c define InitGPIOs(). void InitGPIOs ( void ) {     phhalPcr_ConfigInput ( 2 , true , false , false , false , true , false ) ;     phhalPcr_ConfigInput ( 3 , true , false , false , false , true , false ) ; } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ Hardware configuration section: For the Hardware set up, two push buttons will be connected to GPIO_2 and GPIO_3 of PNEV7462B as follows. Vdd will be connected to 3V3 pin on the board: GND can be connected to any GND on the board. Demonstration: Each tag was previously written with a text NDEF message respectively.   Tag 1: Text: Tag1 Language: en   Tag 2: Text: Tag2 Language: en   Writing to a tag can be done by making use of our TagWriter app available in the play store: NFC TagWriter by NXP - Aplicaciones de Android en Google Play  First both tag's NDEF text messages will be displayed: Once the information is read, you'll be asked to select an option from the following menu: If left button (GPIO_2) is pressed, the content from Tag 1 will be written to Tag 2: Otherwise, If left button (GPIO_3) is pressed, the content from Tag 2 will be written to Tag 1: Please find the modified files attached. I hope this is of great help! Best regards, Ivan.
View full article
Hello NFC community,  as you may know the The PN7462 family consists of 32-bit Arm® Cortex®-M0-based NFC microcontrollers offering high performance and low power consumption. It has a simple instruction set and memory addressing along with a reduced code size compared to existing architectures. PN7462 family offers an all-in-one-solution, with features such as NFC, supporting all NFC Forum modes, microcontroller, optional contact smart card reader, and software in a single chip. It operates at CPU frequencies of up to 20 MHz. and  MIFARE® Ultralight-based tickets offer an ideal solution for low-cost, high-volume applications such as public transport, loyalty cards and event ticketing. They serve as a perfect contactless replacement for magnetic stripe, barcode, or QR-code systems. The introduction of the contactless MIFARE Ultralight® ICs for limited-use applications can lead to reduced system installation and maintenance costs. As you may know the MIFARE family has the Ultralight C tag which is a contactless IC supporting 3DES cryptography is mostly used in limited use applications such smart ticketing, this tag complies with ISO 14443-3 type A and it is defined as type 2 tag. In this document I am going to show you how to modify an example that is provided in the NXP Reader Library to authenticate to a not personalized Mifare Ultralight C and perform a Read operation. Materials: PN7462 or PNEV7462 ( this is the evaluation board  from NXP) PN7462 Reader library Mifare Ultralight C Mifare Ultralight C Data sheet MCUXpresso First we are going to go to  NfcrdlibEx4_MIFAREClassic.c, I am going to explain as much as I can with comments in the code and add some information here we are going to  add the following include: #define MFULC_READ_DATA_SIZE 16 /* Number of bytes that is read by MIFARE Ultralight Read command */ #define MFULC_USER_MEMORY_BEGIN 0x04 /* Number of bytes that is read by MIFARE Ultralight Read command */ #define MFULC_PAGE_SIZE 0x04 /* Size of page of MIFARE Ultralight card */ #define KEYCOUNT 0x7FU /* number of keys */ #define KEYVERSIONS 0x01U /* number of key versions */ #define RAND_KEY_2K3DES_ADDRESS 0x01U /* Random 2K3DES key address in keystore */ #define RAND_KEY_2K3DES_VERSION 0x00U /* Random 2K3DES key version in keystore */ #define UL_C_KEY_ADDRESS 0x02U /* Ultralight C key address in keystore */ #define UL_C_KEY_VERSION 0x00U /* Ultralight C key version in keystore */ #define KEY_POSITION 0x00U /* Key position */ ‍ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ after this in the Global Variable declaration section we will have to add the following: phCryptoSym_Sw_DataParams_t cryptoEnc ; /* CryptoSym parameter structure for ENC */ phCryptoSym_Sw_DataParams_t cryptoSymRng ; /* CryptoSym parameter structure for SymRng */ phCryptoRng_Sw_DataParams_t cryptoRng ; /* CryptoRng parameter structure for Rng */ phKeyStore_Sw_DataParams_t keyStore ; /* KeyStore parameter structure */ static uint8_t gaUlcKey [ ] = { 0x49 , 0x45 , 0x4D , 0x4B , 0x41 , 0x45 , 0x52 , 0x42 , 0x21 , 0x4E , 0x41 , 0x43 , 0x55 , 0x4F , 0x59 , 0x46 } ; phacDiscLoop_Sw_DataParams_t * pDiscLoop ; /* Discovery loop component */ void * psKeyStore ; void * psalMFUL ; void * ppalMifare ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ the variable static uint8_t gaUlcKey[] = {0x49, 0x45, 0x4D, 0x4B, 0x41, 0x45, 0x52, 0x42, 0x21, 0x4E, 0x41, 0x43, 0x55, 0x4F, 0x59, 0x46}; this is the key for default in the Mifare Ultralight c as stated in the datasheet section 7.5.6 this is a reference for the key we should be using. Then we are going to change the PAL variables /*PAL variables*/ phKeyStore_Sw_KeyEntry_t aKeyEntry [ KEYCOUNT ] ; phKeyStore_Sw_KeyVersionPair_t aKeyVersion [ KEYCOUNT * KEYVERSIONS ] ; phKeyStore_Sw_KUCEntry_t aKeyUsageCounter [ KEYCOUNT ] ; uint8_t bDataBuffer [ DATA_BUFFER_LEN ] ; /* universal data buffer */ uint8_t bSak ; /* SAK card type information */ uint16_t wAtqa ; /* ATQA card type information */ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ then we are going to change this in line 131 psalMFC = phNfcLib_GetDataParams ( PH_COMP_AL_MFC ) ; ‍‍ ‍ to psalMFUL = phNfcLib_GetDataParams ( PH_COMP_AL_MFUL ) ; ‍‍ ‍ so this get the MIFARE Ultralight AL-Components, then after this line we are going to add  ppalMifare = phNfcLib_GetDataParams ( PH_COMP_PAL_MIFARE ) ; ‍‍ ‍  then we are going to erase the Mifare classic  functionality to avoid any kind of error due to Mifare classic not being present in the field.and add the following: First we are going to proceed with the Authentication part, we are going tu use the API phalMful_UlcAuthenticate(pDataParams, wKeyNumber, wKeyVersion);  the first  parameter is the structure pointing to the tag that was activated by the discoveryloop, then the key address and last the  version of the key. as you can see we do not send the key we only tell the tag where is the key stored and the version if it was updated. to ensure the confidentiality of the communication. /* Authenticate with the Key even if no memory of Ultralight Card is restricted by Authentication access Authentication with correct key provides access to any part of the memory (beside key storage) . */ /* Send authentication for entire Ultralight C */ status = phalMful_UlcAuthenticate ( psalMFUL , UL_C_KEY_ADDRESS , UL_C_KEY_VERSION ) ; /* Check for Status */ if ( ( status & PH_ERR_MASK ) != PH_ERR_SUCCESS ) { /* Print Error info */ DEBUG_PRINTF ( "\nAuthentication Failed!!!" ) ; DEBUG_PRINTF ( "\nPlease correct the used key" ) ; DEBUG_PRINTF ( "\nExecution aborted!!!\n" ) ; break ; } DEBUG_PRINTF ( "\nAuthentication Successful" ) ; / * ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ after this the status should be  OK  and no error found, if you have an error in this please check that the card you are using was not tampered before and changed the key or if you distributor delivered a configured key please be sure to use the correct key. then we are going to proceed to the Read operation: phalMful_Read(pDataParams, bAddress, pData) as you can see  the first parameter is the same as authentication because we are still talking to the same tag,  the MFULC_USER_MEMORY_BEGIN its value is 04 this is because as you can see in the datasheet section 7.5 Memory organization the user memory starts in page 4 and ends in page 39 so we just want to read the first page of the tag and the bDataBuffer variable will store the received information. /* *************** READ operation ****************************** */ /* Empty the bDataBuffer */ memset ( bDataBuffer , '\0' , DATA_BUFFER_LEN ) ; DEBUG_PRINTF ( "\n\nRead data from page %d, %d, %d, %d" , MFULC_USER_MEMORY_BEGIN , MFULC_USER_MEMORY_BEGIN + 1 , MFULC_USER_MEMORY_BEGIN + 2 , MFULC_USER_MEMORY_BEGIN + 3 ) ; /* Read data from custom */ status = phalMful_Read ( psalMFUL , MFULC_USER_MEMORY_BEGIN , bDataBuffer ) ; /* Check for Status */ if ( status != PH_ERR_SUCCESS ) { /* Print Error info */ DEBUG_PRINTF ( "\nRead operation failed!!!\n" ) ; DEBUG_PRINTF ( "\nExecution aborted!!!\n\n" ) ; break ; /* Break from the loop*/ } DEBUG_PRINTF ( "\nRead Success" ) ; DEBUG_PRINTF ( "\nThe content of page %d is:\n" , MFULC_USER_MEMORY_BEGIN ) ; phApp_Print_Buff ( & bDataBuffer [ 0 ] , MFULC_READ_DATA_SIZE ) ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ and that is all of our project, this is a simple project but can help a lot of people to understand how to work with Mifare Ultralight C using the PN7462 and then help people to start doing more complex examples based on this project. if you want to know how to configure a Mifare Ultralight c product using our PEGODA reader please check the document I posted called "Mifare Ultralight C - Changing default password and protecting page address". if you have any questions please let me know. BR Jonathan
View full article
The NFC Reader Library is a complete software support library for NFC Frontend ICs. Designed to give developers a faster and simpler way to deliver NFC-enabled products. This multi-layer library, written in C, makes it easy to create NFC based applications. The NFC Reader Library includes a package for K82F. This package can be download from this page. The version used is 05.22.01 - NFC Reader Library for FRDM F82K HW Changes Connecting FRDM_K64F toCLEV6630B Import into MCUXpresso SW Changes (FRDM_K64F) Import the hello_world_demo_apps example Add the source code Basic Discovery Loop Example Link the NFC Reader Library Define FRDM_K64F SDK preprocessor symbols Add include paths Add folder to Source Location Files Modifications phDriver_KinetisSDK.c Board_FRDM_K64FRc663.h BoardSelection.h ph_NxpBuild_App.h phApp_Init.h phApp_Init.c K64 Drivers Demonstration HW Changes The CLEV6630B board has the CLRC663 connected with LPC1760 MCU via SPI. The design of the CLEV6630B  makes it very easy to use another MCU, which is what we need to do. To have direct access from FRDM_K64F to CLRC663, this change is needed: the six resistors marked by red squares need to be removed to obtain proper decoupling of the LPC1769 MCU from the CLEV6630B board. Connecting FRDM_K64F to CLEV6630B These are the connections required for this porting: FRDM_K64F pin Connection CLEV6630B pin J2-8 / PTD2 MOSI MOSI J2-10 / PTD3 MISO MISO J2-12 / PTD1 SCK SCK J2-6 / PTD0 SSEL SSEL J1-2 / PTC16 IFSEL0 IF0 J1-4 / PTC17 IFSEL1 IF1 J1-11 / PTC0 IRQ IRQ J1-5 / PTC1 RESET CLRC_NRST J2-14 / GND GND GND Import into MCUXpresso In the Quickstart Panel, click on Import project(s) from file system… Browse the project archive (zip) from your file system. Click Next to select the projects needed (In this example, is just imported the Basic Discovery Loop example). Click on Finish to import the selected ones. The imported projects will appear in the Project Explorer of the workspace. SW Changes (FRDM_K64F) Download and install the K64F SDK from the SDK Builder. Import the hello_world_demo_apps example Click on Import SDK example(s)... Select the frdmk64f. Import the hello_world example and click on Finish. Then we rename the project to frdm_k64f_basic_discovery_loop . Over this project we are going to apply the changes Add the source code Basic Discovery Loop Example Copy the NfcrdlibEx1_BasicDiscoveryLoop.c to our K64 project. Also copy from the src folder the phApp_Init.c file from NfcrdlibEx1_BasicDiscoveryLoop to frdm_k64f_basic_discovery_loop source folder. Link the NFC Reader Library We add the DAL , NxpNfcRdLib , phOsal and intfs folders from NfcrdlibEx1_BasicDiscoveryLoop project to the frdm_k64f_basic_discovery_loop project. Right click on the frdm_k64f_basic_discovery_loop project , click on New>Folder: Click on Advanced, and select Link to alternate location (Link Folder). Click on Browse… browse to your workspace and choose the NxpNfcRdLib folder. Click on Finish. The same procedure has to be done with the DAL , phOsal and intfs folders. The project should appear with the following structure: Define FRDM_K64F SDK preprocessor symbols We need to change the compiler preprocessor configuration. Right click on the frdm_k64f_basic_discovery_loop Project. Click on Properties.. Go to C/C++ Build>Settings>Tool Settings>MCU C Compiler>Preprocessor The actual symbols are related with the board, but we need to add the related with the Reader Library. These are the symbols we need to add: PHDRIVER_FRDM_K64FRC663_BOARD PH_OSAL_NULLOS NXPBUILD_CUSTOMER_HEADER_INCLUDED Then click on Apply and Close, and Yes. Add include paths After that we add the paths of the folders we recently linked: Right click on the frdm_k64f_basic_discovery_loop Project. Click on Properties.. Go to   C/C++ Build>Settings>Tool Settings>MCU C Compiler>Includes The Include paths should be listed like this: Add folder to Source Location Then we add the root folder to the Path and Symbols: Right click on the   frdm_k64f_basic_discovery_loop  Project. Click on Properties.. Go to   C/C++ General>Path and Symbols>Source Location Files Modifications phDriver_KinetisSDK.c We need to change some lines in the DAL>KinetisSDK>phDriver_KinetisSDK.c file: GPIO_PortClearInterruptFlags ( ( GPIO_Type * ) pGpiosBaseAddr [ bPortGpio ] , bPinNum ) ; ‍‍‍‍‍‍‍‍‍‍ ‍ bValue = ( uint8_t ) ( ( GPIO_PortGetInterruptFlags ( ( GPIO_Type * ) pGpiosBaseAddr [ bGpioNum ] ) >> bPinNum ) & 0x01 ) ; bValue = ( uint8_t ) GPIO_PinRead ( ( GPIO_Type * ) pGpiosBaseAddr [ bGpioNum ] , bPinNum ) ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ GPIO_PinWrite ( ( GPIO_Type * ) pGpiosBaseAddr [ bGpioNum ] , bPinNum , bValue ) ; ‍‍‍‍‍‍‍‍‍‍ ‍ GPIO_PortClearInterruptFlags ( ( GPIO_Type * ) pGpiosBaseAddr [ bGpioNum ] , ( 1 << bPinNum ) ) ; ‍‍‍‍‍‍‍‍‍‍ ‍ These changes are related to the names of the functions in our SDK version (2.7.0). We can erase the Linux , LPCOpen and PN74xxxx folders, we don’t need them for this migration.  frdm_k64f_basic_discovery_loop>DAL>src Also, to avoid multiple definitions issues, we erase the phOsal>src>NullOS>portalble>psOsal_Port_CM3.c file. Board_FRDM_K64FRc663.h The architecture of the NFC Reader Library makes it very simple to be able to use other MCU’s, since you only need to adapt the configuration of the peripheral drivers. To do this, there are some changes required in the DAL (Driver Abstraction Layer) of the Reader Library. In frdm_k64f_basic_discovery_loop> DAL>boards folder, are some header files with the information of different MCU’s and Readers. We need to add our header file: Board_FRDM_K64FRc663.h We can copy the Board_FRDM_K82FRc663.h , rename and make the needed modifications. BoardSelection.h Then we add the K64 option to the BoardSelection.h header. #ifdef PHDRIVER_FRDM_K64FRC663_BOARD # include <Board_FRDM_K64FRc663.h> #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ph_NxpBuild_App.h #if defined(PHDRIVER_LPC1769RC663_BOARD) \ || defined(PHDRIVER_FRDM_K82FRC663_BOARD) \ || defined(PHDRIVER_FRDM_K64FRC663_BOARD) # define NXPBUILD__PHHAL_HW_RC663 #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ phApp_Init.h /* Check for K64 controller based boards. */ #if defined(PHDRIVER_FRDM_K64FRC663_BOARD) #define PHDRIVER_KINETIS_K64 #endif‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ #ifdef PHDRIVER_KINETIS_K64 # include <fsl_debug_console.h> # include <stdio.h> #endif #ifdef DEBUG #if defined(PHDRIVER_KINETIS_K82) || defined (PHDRIVER_KINETIS_K64) #if SDK_DEBUGCONSOLE==1 #define DEBUG_PRINTF DbgConsole_Printf #else #define DEBUG_PRINTF(...) printf(__VA_ARGS__); #endif #else /* PHDRIVER_KINETIS_K82 */ #include <stdio.h> #define DEBUG_PRINTF(...) printf(__VA_ARGS__); fflush(stdout) #endif /* PHDRIVER_KINETIS_K82 */ #else /* DEBUG */ #define DEBUG_PRINTF(...) #endif /* DEBUG */ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ phApp_Init.c Also we to add the FRDM_K64F CPU initialization in phApp_Init.c : #ifdef PHDRIVER_KINETIS_K64 #include <fsl_port.h> #include <fsl_pit.h> #ifdef DEBUG #include <fsl_clock.h> #endif #endif /* PHDRIVER_KINETIS_K64 */ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ #ifdef PHDRIVER_KINETIS_K64 static void phApp_K64_Init ( void ) ; #endif /* PHDRIVER_KINETIS_K64 */ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ #ifdef PHDRIVER_KINETIS_K64 static void phApp_K64_Init ( void ) { pit_config_t pitConfig ; BOARD_BootClockRUN ( ) ; SystemCoreClockUpdate ( ) ; PIT_GetDefaultConfig ( & pitConfig ) ; PIT_Init ( PIT , & pitConfig ) ; BOARD_InitPins ( ) ; } #endif /* PHDRIVER_KINETIS_K64 */ ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ #elif defined(PHDRIVER_KINETIS_K64) phApp_K64_Init ( ) ; ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ K64 Drivers The hello_world example does not use SPI and PIT drivers, we need to add these drivers to our project: Right click on the   frdm_k64f_basic_discovery_loop  Project. Click on SDK Management>Manage SDK Components And we add the dspi and pit drivers: Demonstration With all these changes, now we can run the Basic Discovery Loop with the FRDM_K64F and the CLRC663.
View full article
Hello NFC Community,   This document focuses to the configuration of the LPC8N04 to be controlled by the data it receives though the NFC interface. The document is based on the nfc_eeprom project of LPC8N04’s SDK. It will basically be necessary to modify the code within while(1) loop as below.   Get the data from NFC and store it on d_Data buffer:             if ( NDEFT2T_GetMessage ( g_NdefInstance , g_Data , sizeof ( g_Data ) ) ) { /* Save NDEF Data into EEPROM */ //Chip_EEPROM_Write(LPC_EEPROM, 0, g_Data, sizeof(g_Data)); } ‍ ‍ ‍ ‍ ‍ ‍ ‍ Clear respective semaphore and Flag: /** Clear Memory Write Semaphore */ releaseMemSemaphore ( ) ; /** Clear Write Flag */ g_TargetWritten = 0 ; ‍ ‍ ‍ ‍ ‍ ‍ ‍   Now that the information is in the g_Data buffer now you may proceed to verify the received data with the one expected to trigger a function e.g., to turn on/off a led.   if ( g_Data [ 7 ] == 'A' ) { Led_Set ( true ) ; } else if ( g_Data [ 7 ] == 'B' ) { Led_Set ( false ) ; } ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍     On the other side, it will only be necessary to approach the reader to the LPC8N04's antenna and the NDEFT2T_GetMessage(g_NdefInstance, g_Data, sizeof(g_Data)) function will get the data and store it on the g_data buffer mentioned above. Happy development! BR, Ivan.
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
Hello NFC enthusiasts,   In the NFC communication protocol, when a device acts as a NFC reader (it provides its own field), it is waiting for a tag to approach. When this occurs, the reader energizes the tag and depending on the application, it can read from or write to a tag.   When multiple tags are in the field, the power decreases according to the number of tags being energized, for which the tag operations will not work properly. For this, there is a process called anti-collision, in which the reader decides, from the detected tags, one to work with.   The purpose of this document is to demonstrate the activation of each tag at a given index.   This demonstration is going to be made with two NTAG 216.     This demonstration is based on NXP NFC Reader Library v05.02.00, NfcrdlibEx3_NFCForum project for PNEV7462B, in which some modifications are going to be made in order to carry this out. These tags are compliant with NFC Forum Type 2 Tag and ISO/IEC14443 Type A specifications.    In phacDiscLoop.h modify the max number of cards supported (two cards for this demonstration):   #define PHAC_DISCLOOP_CFG_MAX_CARDS_SUPPORTED 0x02U      In NfcrdlibEx3_NFCForum.c add the following code in  LoadDiscoveryConfiguration():   static phStatus_t LoadDiscoveryConfiguration ( ) { . . . /*Passive max typea devices*/ status = phacDiscLoop_SetConfig ( pDiscLoop , PHAC_DISCLOOP_CONFIG_TYPEA_DEVICE_LIMIT , 2 ) ; CHECK_STATUS ( status ) ; }   A fix to the SW stack has to be made (Fix will be implemented in the next release): open "phacDiscLoop_Sw_Int_A.c", line 511, change if statement as below.     if ( ( pDataParams -> sTypeATargetInfo . bTotalTagsFound > 1 ) && ( ( bTypeATagIdx ) < pDataParams -> sTypeATargetInfo . bTotalTagsFound ) )     Until now, the reader is able to detect a maximum of two tags and work with up to two type A devices.   The activation of a tag at a given index is possible to the phacDiscLoop_ActivateCard() function.   Once this function is called, it will receive the discovery loop data parameters, the type of tag and the index of a tag to be activated.   The code will be added after knowing that multiple tags are detected and resolved in the NfcrdlibEx3_NFCForum.c file.   else if ( ( status & PH_ERR_MASK ) == PHAC_DISCLOOP_MULTI_DEVICES_RESOLVED ) { /* * Multiple cards resolved. It enters here if DEVICE LIMIT > 1 and more than one devices are * detected and resolved. */ DEBUG_PRINTF ( " \n Multiple cards resolved: \n" ) ; /* Get detected technology type */ status = phacDiscLoop_GetConfig ( pDiscLoop , PHAC_DISCLOOP_CONFIG_TECH_DETECTED , & wTagsDetected ) ; CHECK_STATUS ( status ) ; /* Get number of tags detected */ status = phacDiscLoop_GetConfig ( pDiscLoop , PHAC_DISCLOOP_CONFIG_NR_TAGS_FOUND , & wNumberOfTags ) ; CHECK_STATUS ( status ) ; DEBUG_PRINTF ( "\tNumber of tags: %d \n" , wNumberOfTags ) ; /* Code */ . . . } Note: The code to be inserted in the comment /* Code */ is below in the Code section of this document.   The demonstration will be as simple as activating one tag, read its NDEF message, activate the second tag and read its NDEF message as well so that we make sure the activation process is performed correctly.   Each tag was previously written with a text NDEF message respectively.   Tag 1: Text: Hallo! Language: de   Tag 2: Text: ¡Hola! Language: es   Writing to a tag can be done by making use of our TagWriter app available in the play store: NFC TagWriter by NXP - Aplicaciones de Android en Google Play    Code section:   uint8_t bTagState1 ; /* Tag 1 */ /* Activate tag at index 0 */ status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x00 ) ; /* Check for NDEF presence */ status = phalTop_CheckNdef ( palTop , & bTagState1 ) ; /* Read NDEF message */ status = ReadNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ; DEBUG_ERROR_PRINT ( status ) ; /* Tag 2 */ /* Activate tag at index 1 */ status = phacDiscLoop_ActivateCard ( pDataParams , PHAC_DISCLOOP_TECH_TYPE_A , 0x01 ) ; /* Check for NDEF presence */ status = phalTop_CheckNdef ( palTop , & bTagState1 ) ; /* Read NDEF message */ status = ReadNdefMessage ( PHAL_TOP_TAG_TYPE_T2T_TAG ) ; DEBUG_ERROR_PRINT ( status ) ;   Behavior shown in the console monitor:   NFC Forum Example:       This implementation demonstrated the activation of two type A tags at a given index. I hope this is of great help!   Best regards, Ivan. Original Attachment has been moved to: Project-files.zip
View full article
You are a salesperson or FAE and are looking for ways to sell more Near-Field-Communication (NFC) products? This community provides ideas, information, and materials that help you to successfully sell more NFC products. Content Use Cases Authentication, Automatic Configuration Configuration, Parametrization, Diagnosis, FW Update Pairing Access Control Training material Customer presentations Demos Collaterals Development Kits Webinar Playlist Design-in resources Further Resources Use Cases Convincing a customer of NFC starts with presenting clear use cases and benefits. Although the following use cases are already implemented in the market, not all customers know that they can benefit from NFC in these applications. Therefore, it is your opportunity to propose them to the customer! Authentication, Automatic Configuration "Everything which has consumables or accessories." Does your product have consumables or accessories? Product examples: Filters, appliances, medical, consumer Short reel: How NFC can countersteer product counterfeiting Customer presentation Configuration, Parametrization, Diagnosis, FW Update "Replace DIP switches and service UARTs – control via an app without power." Do you use DIP- or rotary switches for parameterization? Do you plan to configure or Diagnose your product via an app without draining its battery? Do you make water- or dust-proof products? Product examples: Industrial control, automation, consumer electronics Short reel: NFC for parameterization and diagnosis Customer presentation Pairing "Easy pairing." Do smartphones typically connect to your product via Bluetooth or Wi-Fi? Product examples: Bluetooth speakers, Set-top-box, TV remote control Short Reel: NFC for pairing and commissioning Customer presentation Access Control "Card reading for the next generation of residential locks." Are you designing an access control solution? Product examples: Smart locks, electronic locks Short Reel: NFC in Access Control Customer presentation Training material The complete training presentation “How to sell NFC” can be used for branch office training or for self-studying. DFAE training for NFC: Get certified in the NFC domain. Learn how to build easy and convenient solutions for customers using NTAG® tags and readers. NFC Training and Support Catalog: In this catalog, you’ll find online training sessions that will enrich your knowledge of NFC products and how to use them. Customer presentations The DistyNet offers customer presentations for each use case, plus the overview presentation “NFC Everywhere New ”. The NFC Reference book is a collection of success stories and real-world NFC implementations, which is also available on the DistyNet. NFC Golden Presentation Updated provides all needed information on the NFC products and use cases. Demos The NFC Cube is perfectly suited for a first NFC demo and demonstrates all use case principles. An instruction video as well as more information can be found here . If you need an NFC Cube, please ask your NXP DBM or DTRM. The Schneider Zelio timer relay is an excellent demo to show how NFC adds value for parameterization and diagnosis – basically replacing mechanical elements like DIP switches, rotary switches, or connectors. Search your local RS  shop or other electronics distributor for RENF22RMMW. Here are some selected links: UK Germany USA China This NTAG 5 Demo Kit  New is mainly targeted for sales and FAEs to show quick and easy functionality of NTAG 5 products to the customers. The kit is a combination of 3 boards in a single pack, one each for the switch, link, and boost products.  The demo boards are enabled to show the product features either with the NFC cube or with Android TM  and iOS apps available for free download in the respective App stores. Link to ordering demo kit: OM2NTA5KIT The Creative Muvo Mini speaker shows the easy pairing process of Bluetooth® devices via NFC. It is available via sources like Amazon. Collaterals All listed collaterals are also available in printed form. Please reach out to your NXP DBM or DTRM. NFC Everywhere brochure  Updated Z-Card (Line Card) for NFC Readers and connected tags Z-Card (Line Card) for NFC Tags and Label ICs Leaflet NTAG I²C plus Leaflet NTAG 5 Switch  New Leaflet NTAG 5 Link  New Leaflet NTAG 5 Boost  New Leaflet CLRC663 plus Leaflet PN7462 Family Leaflet PN7150 Leaflet PN5180 Leaflet NTAG 21x Leaftlet MIFARE DESFire Leaflet ICODE SLIX 2 Leaflet NTAG 424 DNA Leaflet MIFARE DESFire Light Development Kits The table lists all relevant development kits for your customers, which allow a quick evaluation as well as support design-ins. NTAG I²C plus NTAG I²C plus Explorer Kit NTAG I²C  plus   Explorer Kit with NFC Reader NTAG I²C plus   Flex Antenna Kit NTAG I2C plus   Kit for Arduino Pinout OM5569/NT322E OM5569/NT322ER OM5569/NT322F OM23221ARD NTAG 5 Development Kits  New NTAG 5 Link and Switch development board NTAG 5 Boost  development board NTAG 5 Demo Kit OM2NTP5332 OM2NTA5332 OM2NTA5KIT  PN5180 PN5180 Eval Kit PN5180 NFC Antenna Development Kit OM25180FDK OM29263ADK  PN7462 PN7462 Eval Kit PN7462 NFC Antenna Development Kit OM27462CDK OM29263ADK  PN7150 PN7150 Arduino Kit PN7150 BBB Kit PN7150 RasPi Kit OM5578/PN7150ARD OM5578/PN7150BBB OM5578/PN7150RPI  CLRC663 plus CLRC663 plus NFC Frontend Development Kit CLEV6630ARD: NFC frontend CLRC663  plus   Arduino interface board  New CLRC663 plus NFC Antenna Development Kit OM26630FDK CLEV6630ARD OM29263ADK  LPC Link 2 OM13054 Webinar Playlist NXP's NFC product portfolio NFC Essentials NFC Applications: NFC for Consumables and Accessories Product support package for NFC Readers & NFC Connected Tags NFC Products: IoT solution made easy with NFC: Bluetooth pairing with the NTAG I2C plus kit for Arduino pinout NFC - NTAG 5 Spotlights  New Design-in resources NFC Software Support: Download NFC drivers/projects for many MCUs Online NFC Antenna Design tool Further Resources NFC Webinars: https://www.nxp.com/support/training-events:TRAINING-EVENTS#/ NFC Website: www.nxp.com/nfc NFC Community: https://community.nxp.com/community/nfc Demo Lab page for customers: https://nxp.surl.ms/nfcdemos If you miss any material, have a suggestion how to improve this page or a general question, please contact  Richard.schmidmaier@nxp.com .         
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
The video shows how to read the NDEF message under password protection. For more details , please kindly refer to https://community.nxp.com/docs/DOC-347622 
View full article
The demonstration aims at how to protect the NDEF messages in the NTAG, here we use OM5569-NT322ER | NTAG I2C plus Explorer Kit + reader | NXP  as this dev kit contains NTAG as well as the NFC reader. The NTAG I2C plus has the unprotected memory starting from page 04h of sector 0, and NDEF messages are stored there. Referring to 8.3.11 of the data sheet, AUTH0 specifies the starting page to be protected, ACCESS[NFC_PROT] enables read&write password protection from NFC interface, PWD and PACK are for password configuration, but before changing any of above , you have to do a password authentication as below: Then you may select sector 0 and read the contents starting from E3h. Here FFh is the default value for AUTH0.  Now you may change the AUTH0, ACCESS[NFC_PROT] , PWD and PACK as you wish, for example, something like below: read the data from E3h to E6h and change the corresponding bytes in one write. The video shows how to read the NDEF message under password protection.  
View full article
Example sends Wi-Fi credentials from phone to IoT device, so it can join the Wi-Fi network.  Using: iOS and Android phone with NXP's TagWriter app PN7462 NFC Reader device on PNEV7462B eval board, part of kit OM27462CDK Host Card Emulation mode example based on NfcrdlibEx8_HCE_T4T example from NFC Reader Library Example will also print out other NDEF messages received.  NDEF formats include: Contacts / Business Cards URL link Wi-Fi network and credentials Bluetooth MAC address for pairing Email address Phone number Geo location Launch application on host OS Plain text SMS (sorry the audio is horrible)
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  i s 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
This demonstration is based on RFIDDiscover full version and Pegoda EV710. You may refer to the following links for more details. RFIDDiscover | NXP  PEGODA Contactless Smart Card Reader | NXP  Before start the demonstration, please connect Pegoda with your PC via USB and place the MIFARE DESFire Light card on the reader. The history and log can be fetched from the attachment. Please refer to the video for more details.  
View full article
MIFARE DESFire Light read and write demonstration
View full article
This post contains a guide of how to use the NFC Reader Library with LPC845 using the Basic Discovery Loop example. The vanilla Basic Discovery Loop example is larger than the flash size of LPC845 (64KB), so the project needs to be reduced in size as well. How to reduce the size is explained in section “Porting the NFC Reader Library and reducing the size of project” A ready to use package “lpcxpresso845max_Basic_Discovery_Loop” example from the NFC Reader Library to be run on LPC845 and CLRC663 plus frontend is attached with this document. This document is structured as follows:   Overview of LPC845 The LPCXpresso-MAX family of boards provides a powerful and flexible development system for NXP's low-end Arm® Cortex®-M0+ based MCUs. They can be used with a range of development tools, including the MCUXpresso IDE toolchain. The LPCXpresso845-MAX board was created to enable evaluation of and prototyping with the LPC84x family of MCUs. Based on the Arm® Cortex®-M0+ core, LPC845 is a low-cost, 32-bit MCU family operating at frequencies of up to 30 MHz. The LPC845 MCU contains 64 KB of flash memory and 16 KB of SRAM.  Hardware Requirements Following hardware is required to run the project: LPCXpresso845-MAX development board. CLEV6630B board or BLE-NFC-V2 board. Both boards contain CLRC663 plus frontend. Here we use BLE-NFC-V2.   Connections Connect the two boards as follows: Porting the NFC Reader Library and reducing the size of Project: The porting of Basic Discovery Loop Example (NFC Reader Library) to LPC845 Max was done following the procedure mentioned in “NFC Reader Library Porting to i.MX RT1050” document. However, after completing the porting and building the project, the size of the binary, which is 134.264 KB, is greater than the size of Flash of LPC845 which is 64KB of flash. To reduce the size of the project, the following two steps were taken: 1. Apply compiler optimization for size. This can be done in the MCUXpresso by: Opening properties of project. Right Click project-   >Properties Go to Settings->Optimization. For Optimization Level choose “Optimize for Size” Building the project after this step results in a successful build but the project takes up 93% of all Flash, leaving very little space for adding more functionality. 2. The vanilla Basic discovery loop example detects all types of NFC tags. This increases our code size, so further size reduction can be achieved by limiting the number of protocols used. To limit our Basic Discovery loop to only look for Type A tags, do the following: Open the file “ph_NxpBuild_App.h” file which is inside in the “intfs” folder. This file defines the protocols (types) which are detected by the Basic Discovery Loop example. The type A cards uses the “ISO 14443-3A” protocol, so comment out all other protocol definitions except for “ISO 14443-3A” protocol as shown in Figure.   Building the project after this step  takes up only 42.784KB of space consuming 65% of the Flash, leaving sufficient amount of space for adding application code.   Running Basic Discovery Loop on LPC845 If this is the first time you’re using the LPCXpresso845 Max board, follow the getting started guide first ->  LPC845Max | NXP . Make sure to install the SDK package LPCXpresso845 Max which is required for the project below to run. Download the “lpcxpresso845max_Basic_Discovery_Loop” 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 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: After step 4, the project should be running now. The output “BasicDiscoveryLoop Example” can be seen in the console. The project contains basic discovery loop functionality. Bring any NFC card near the frontend’s RF antenna and the output console will show the detection and type of the card. Running other examples from NFC Reader Library on LPC845: Once the “lpcxpresso845max_Basic_Discovery_Loop” project is running on the LPC845, running other examples from NFC Reader Library is simple. Here we use the “NfcrdlibEx9_NTagI2C” example from the reader library to describe the process. In “intfs” folder remove everything except the “phaApp_Init.h” file. Then go to the “intfs” folder of the NFC Reader Library example you want to run (“NfcrdlibEx9_NTagI2C” in this case), and copy all the files except “phaApp_Init.h” and paste them in the original “intfs” folder.  I n line 57 of the “ph_NxpBuild_App.h” file in “intfs” folder, replace  Go to “source” folder and remove every file except “phApp_Init.c“ and “semihost_hardfault.c” files. Then go to “src” folder of the example you want to run (“NfcrdlibEx9_NTagI2C” in this case) and copy all the files except “phaApp_Init.c” and paste them into the “source” folder.  Finally, copy the main file of the example you want to run (NfcrdlibEx9_NTagI2C in this case) and paste it into the “source” folder as well. The project is ready to build and run on LPC845. Available Resources: Porting NFC Reader Library to i.MX RT1050. (Detailed Description of porting) https://community.nxp.com/docs/DOC-341843 NFC Reader Library  NFC Reader Library | NXP  LPC845 Max  LPCXpresso845-MAX Board for LPC84x Microcontrollers (MCUs) | NXP 
View full article
DISCLAIMER APPLICABLE TO THIS DOCUMENT CONTENTS: This post contains a guide of how to use i.MXRT1050 demoboard with other NXP demoboards to demonstrate Secure access to industrial IOT, using NFC, embedded secure element and MCU (see picture below). A ready to use package including preparation of a secure element, and of a MIFARE DESFire EV2 card can be used as 3-step authentication example using symmetric AES keys; a session key will be generated inside SE050 which will be exported to i.MXRT1050 which will handle contactless communication thru CLRC663 plus frontend. This document is structured as follows: Hardware Requirements: Following hardware is required to run the project: i.MXRT1050 EVKB development board plus referred TFT LCD Display BLE-NFC-V2 arduino-friendly board. OM-SE050ARD, embedded secure element arduino-friendly R3 board. 1. Overview of i.MXRT1050 EVKB: The i.MXRT1050 EVKB development board provides the ideal platform for evaluation of and development with the i.MX RT1050 crossover processor, featuring NXP’s advanced implementation of the Arm ® Cortex ® -M7 core. The i.MX RT1050 EVK is a 4-layer through-hole USB-powered PCB. The board includes a high performance onboard debug probe, audio subsystem and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, display and other interfaces. This core operates at speeds up to 600 MHz to provide high CPU performance and best real-time response. Support for Amazon FreeRTOS ™ available within the MCUXpresso SDK.The i.MX RT1050 EVK board is now supported by Arm ® Mbed ™ OS and Zephyr ™ OS, both open source embedded operating systems for developing the Internet of Things. i.MXRT1050 EVKB board supported devices Processors and Microcontrollers i.MX RT Series i.MX-RT1050 : i.MX RT1050 Crossover Processor with Arm ® Cortex ® -M7 core Sensors 6-Axis FXOS8700CQ : Digital Motion Sensor - 3D Accelerometer (±2g/±4g/±8g) + 3D Magnetometer Interfaces USB PD-PHY and CC-Logic PTN5110 : USB PD TCPC PHY IC Power Management Load Switches NX3P190UK : Logic controlled high-side power switch NX5P3090UK : USB PD and type C current-limited power switch The i.MXRT1050 EVKB is fully supported by the MCUXpresso suite of tools, which provides device drivers, middleware and examples to allow rapid development, plus configuration tools and an optional free IDE. MCUXpresso software is compatible with tools from popular tool vendors such as Arm and IAR, and the i.MXRT1050 EVKB may also be used with the popular debug probes available from SEGGER and P&E Micro. As final touch to this demonstrator, one LCD display will be added in order to show "access control" check result when approaching a MIFARE DESFire EV2 card to the Reader antenna, without the use of a computer console.Connection between i.MXRT1050 EVKB board and LCD Display requires attachment of two flat cables, one for touch-screeen functionality and the other for controlling Display itself. Click here to order Touchscreen LCD Display thru buy direct:                                          P/N: RK043FN02H-CT 12NC:935358709598 2. BLE-NFC-V2: It is easier to use the BLE-NFC-V2 board due to four Arduino compliant male connectors. Current version has only double row-male connectors which imposes that BLE-NFC-V2 board will be the last board stacked on top of other arduino boards. The following figure shows the pin mapping between the two boards. Pin Function i.MXRT1050  (Arduino connector # - Pin #) CLRC663 plus NFC BLE V2 (Arduino connector # - Pin #) MOSI J24-5 MOSI J10-P14 MISO J24-4 MISO J10-P12 SPI CLK J24-6 SCK J10-P10 SPI CS J24-3 SSEL J10-P16 RESET J22-6 CLRCL_NRST J12-P6 IRQ J22-5 IRQ J12-P8 IFSEL0 J24-7 GND IF0 Via R11 IFSEL1 J25-4 VCC IF1 Via R9 GND J25-6 GND GND J11-P11 Connections between i.MXRT1050 EVKB Board and NFC BLE V2 3 OM-SE050ARD: SE050 Arduino ® Compatible Development Kit The OM-SE050ARD is the flexible and easy-to-use development kit for the EdgeLock™ SE050 Plug & Trust product family. It can be used in various ways for example via the Arduino interface compatible to any board featuring an Arduino compatible header, including many i.MX, LPC and Kinetis ® boards, or via a direct I 2 C connection. This kit allows evaluation of the SE050 product family features and simplifies the development of secure IoT applications. More information can be found in the respective Application Note AN12395. Preparing hardware for "Secure Access to Industrial IOT demo" at i.MXRT1050 EVKB Reworking i.MXRT1050 EVKB: It is necessary to short circuit 4 empty resistor pads: R278, R279, R280 and R281 – they connect SPI from i.MX1050 until Arduino SPI pads, which will be used by NFC BLE V2 board. Reworking NFC-BLE V2 board: I t is necessary to cut at least one male pin to avoid conflict with OM-SE050ARD board (better would be to cut first 2 pins): Configuring OM-SE050ARD board jumpers: Final HW configuration of these three boards altogether: Since NFC BLE V2 has only male connectors, OMSE050ARD board is first connected to i.MX1050 EVKB, then NFC BLE V2 is plugged on top of this latest pcb. Running "Secure Access to Industrial IOT demo" at i.MXRT1050 EVKB:   If this is the first time you’re using i.MXRT1050 EVKB board, follow this link  i.MXRT1050 board overview . Make sure to install the SDK package for i.MXRT1050 EVKB which is required for the project below to run. Download the following zip package Access_RT_v_1_0_18092019.zip. This file is split in two parts and includes 3 functionalities in one MCUxpresso project: Preparation of MFDFEV2 card The touch screen display will offer three functionalities. By default, the first screen will be "Authenticate" functionality. When you choose the arrow to the right, you'll find TAB with word START, that you'll touch when you need to prepare a MIFARE DESFire EV2 card with suitable application and AES keys used for demonstrator. Just place a virgin card on top of Reader antenna, and press "START" button and check with Terminal on MCUxpresso to check sequence of actions to personalize one DESFire EV2 card. You may also use Teraterm to monitor the execution of DESFire card personalization, by inspecting the COM number used by i.MXRT1050 board.     Preparation of SE050 with proper keys    When you choose the arrow to the left once, you'll find TAB with word Authenticate; if you do it again, then you'll the word "START", which you will touch when you need to prepare a virgin OM-SE050ARD demoboardcard with suitable application and AES keys used for demonstrator. Just press "START" button and check with Terminal on MCUxpresso to check sequence of actions to personalize one SE050 board. You may also use Teraterm to monitor the execution of SE050 key provisioning, by inspecting the COM number used by i.MXRT1050 board. After steps 2.a and 2.b have been done to obtain preparation of one Secure element as well as preparation of one MIFARE DESFire EV2 card, then select using < and > keys the Default Display menu, containing word "Authenticate" : just place DESFire EV2 card on top of NFC antenna and press "Authenticate". If the DESFire EV2 card is the one you have personalized, you'll see a Locker icon that will show "Open locker" , that is "Access granted action". If you place other cards, "Locker icon"will stay closed, that is "Access denied". Again, use MCUxpresso Terminal or  use Teraterm to monitor the execution of  DESFire EV2 authentication steps with SE050  by inspecting the COM number used by i.MXRT1050 board. Available Resources: Quick start guide to integration of SE050 with i.MXRT1050 https://www.nxp.com/docs/en/application-note/AN12450.pdf i.MXRT1050 EVKB i.MX RT1050 Evaluation Kit | NXP  BLE-NFC-V2 https://www.nxp.com/products/identification-security/rfid/nfc-hf/nfc-readers/clrc663-iplus-i-and-qn902x-nfc-bluetooth-low-energy-solution-for-consumer-applications:BLE-NFC SE050: www.nxp.com/SE050 In the attachment area, you'll find:  three *.axf files you may use to upload using MCUxpresso and direct firmware flashing functionality to i.MXRT1050 EVKB board. one bundle zip file split in 5 files: hands-on zip, hands-on from .z01 until hands-on.z04, due to maximum limit of 50Megabytes for file uploading to this page. download all 5 files, unzip them in one laptop directory, then you may re-zip them and import in MCUxpresso. They include draft of all three functionalities of secure access to industrial iot hands-on: DESFire EV2 card preparation, SE050 trust provisioning (with keys) and authentication of card with current installed SE050.
View full article
DISCLAIMER APPLICABLE TO THIS DOCUMENT CONTENTS: This post contains a guide of how to use LPC55S69 demoboard with other NXP demoboards to demonstrate Access control using NFC, one embedded secure element and an MCU (see picture below). A ready to use package including preparation of a secure element, and of a MIFARE DESFire EV2 card can be used as 3-step authentication example using symmetric AES keys; a session key will be generated inside SE050 which will be exported to LPC55S69 which will handle contactless communication thru CLRC663 plus frontend. This document is structured as follows: Hardware Requirements: Following hardware is required to run the project: LPC55S69-EVK development board. OM-SE050ARD development board. CLEV6630B board or BLE-NFC-V2 board. 1. Overview of LPC55S69-EVK: The LPCXpresso55S69 development board provides the ideal platform for evaluation of and development with the LPC55S6x MCU based on the Arm® Cortex®-M33 architecture. The board includes a high performance onboard debug probe, audio subsystem and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, displays and other interfaces. The LPCXpresso55S69 is fully supported by the MCUXpresso suite of tools, which provides device drivers, middleware and examples to allow rapid development, plus configuration tools and an optional free IDE. MCUXpresso software is compatible with tools from popular tool vendors such as Arm and IAR, and the LPCXpresso55S69 may also be used with the popular debug probes available from SEGGER and P&E Micro. 2. Overview of OM-SE050ARD demoboard: The OM-SE050ARD is the flexible and easy-to-use development kit for the EdgeLock SE050 Plug & Trust product family. It can be used in various ways for example via the Arduino interface compatible to any board featuring an Arduino compatible header, including many i.MX, LPC and Kinetis boards, or via a direct I 2 C connection. This kit allows evaluation of the SE050 product family features and simplifies the development of secure IoT applications. More information can be found in the respective Application Note AN12395.   2.1 Connections between OM-SE050ARD and LPC55S69 EVK   OM-SE050ARD LPC55S69 (Conn.# - Pin #) Port Function Name SE_SDA (J22-1) P24-6 also P17-3 PIO1_21 FC4_I2C_SDA_ARD SE_SCL (J22-4) P24-5 also P17-1 PIO1_20 FC4_I2C_SCL_ARD +5V_PC (J22-2) VDD_TARGET GND (J22-3) GND 2.2 Jumper settings on OM-SE050ARD to connect it to LPC55S69 EVK Connect SE050 to LPC55S Arduino stackable headers and change jumper J14 as: This connects SE_VDD directly to 3V3 and bypasses enable signal. This is required because enable pin on LPC55S coincides with Silex-2401 SPI pins so we cannot use SE_EN signal to drive SE_VDD. 3. Overview of NFC Front end boards working with LPC55S69 EVK board for this example: 3.1 BLE-NFC-V2: It is easier to use the BLE-NFC-V2 board since less changes have to made on the board as compared to the CLEV6630B board. The following figure shows the pin mapping between the two boards. It is advisable to add a pull-up resistor (4k7 to VCC) on CLRC663 plus signal IRQ. 3.2 CLEV6630B board: The CLEV6630B board consists of CLRC663 plus (NFC frontend) connected by default to an LPC1769 µC via SPI. However, the board is made in such a way that the LPC1769 MCU can be bypassed to connect to an external MCU (in our case the LPC55S69) easily. For doing so: Six resistors from the board need to be removed. These are highlighted in red in the Figure 1: Use the SPI pin connectors available on the left-hand side, on the board edge to connect to external MCU (LPC55S69 in this case) Solder jumper wires onto the following pins of CLEV6630B Board:  GND IRQ CLRC_NRST SSEL MOSI MISO SCK IF0 IF1      The CLEV6630B is shown in Figure 2 after the required changes have been made to it (Removal of resistors and soldering of wires).   Now connect the two boards as follows: Signal function LPC55S69 (conn. # - Pin #) Port CLEV6630B MOSI P17-10 PIO0_20 MOSI MISO P17-12 PIO0_19 MISO SPI SCK P17-14 PIO0_21 SCK SPI CSEL P17-6 PIO1_11 SSEL RESET P18-11 PIO0_15 CLRCL_NRST IRQ P18-3 PIO1_10 IRQ GND P17-7 GND  As final touch to this demonstrator, one LCD display will be added in order to show "access control" check result when approaching a MIFARE DESFire EV2 card to the Reader antenna, without the use of a computer console. Connection between LPC55S69 board and LCD Display: TFT LPC55S69 (Jumper # - Pin #) Port      SPI_CLK D13 (P17-9) PIO1_2      SPI_MISO D12 (P17-11) PIO1_3      SPI_MOSI D11 (P17-13) PIO0_26      SPI_CS_TFT D10 (P17-15) PIO1_1      GPIO_LCD_BL D9 (P17-17) PIO1_5      GPIO_LCD_DC D7 (P18-1) PIO1_9 5V 5V   GND GND   Click here to order 2.8 inch TFT Display from Waveshare: P/N: 2.8 inch TFT Touch Shield Brand     4. Running "Secure Access to Industrial IOT demo" at LPC55S69:   If this is the first time you’re using LPC55S69-EVK board, follow the getting started guide first à  LPC55S69-EVK | NXP . Make sure to install the SDK package for LPC55S69-EVKboard which is required for the project below to run. Download the ‘demobinaries.zip' package which you will find attached to this post. This zip file contains 2 bin files: ex_prepareCard.bin - upload this binary file to LPC55S69 when you need to prepare a MIFARE DESFire EV2 card with suitable application and AES keys used for demonstrator. Upload bin file to LPC55S69 by using MCUxpresso. Just place a virgin card on top of Reader antenna, and reset MCU board by clicking on "RESET KEY" push button. ex_prepareSe050.bin - upload this binary file to LPC55S69 when you need to prepare a new SE050 with suitable AES keys to be used in this demo. Just  upload binary using MCUxpresso; connect a virgin OM-SE050ARD on LPC55S69 arduino connectors, connect micro USB connector to MCU board, and reset MCU by clicking "RESET KEY". After steps 2.1 and 2.2 have been done to obtain preparation of one Secure element as well as preparation of one MIFARE DESFire EV2 card, then upload the next bin file to LPC55S69 using MCUxpresso: ex_Ev2Auth_se05x.bin Alternatively, you can import the whole project in your MCUxpresso environment. Download the file EmbeddedWorld2019DemoLatest.zip at end of this page. Import this zip file project in MCUxpresso environment Now that the package has been imported to the MCUXpresso IDE (via drag and drop), click on Debug icon from the Quickstart panel to begin a debug session. Once the debug session has started, click on the run icon to run the code: PICTURE TO BE UPDATED MCUXPRESSO PICTURE TO BE UPDATED The project should be running now. The project contains a closed loop that tries to check presence of a card on top of Reader. Here is how the output looks like in LCD Display. Press the button reset, and you will see the text "Secure Access to Industrial IOT demo 2019" PICTURE TO BE UPDATED Then press the button "Wake-up". Afterwards NFC reader will enter in a loop in which he will look for a card to authenticate. If there are no cards, he will soon show the red allert with text "Access denied" Bring any NFC card near the frontend’s antenna (or in presence of no card) LCD display will show a message in RED "ACCESS DENIED". PICTURE TO BE UPDATED Only in case the "prepared DESFire EV2" card is placed on top of reader, in the picture below, we can see message in GREEN "ACCESS GRANTED" PICTURE TO BE UPDATED. Available Resources: Porting NFC Reader Library to i.MX RT1050. (Detailed Description of porting) https://community.nxp.com/docs/DOC-341843 LPC55S69 https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc5500-cortex-m33/lpcxpresso55s69-development-board:LPC55S69-EVK BLE-NFC-V2 https://www.nxp.com/products/identification-security/rfid/nfc-hf/nfc-readers/clrc663-iplus-i-and-qn902x-nfc-bluetooth-low-energy-solution-for-consumer-applications:BLE-NFC CLEV6630B Product Information|NXP  SE050: www.nxp.com/SE050
View full article
This post contains a guide of how to use the NFC Reader Library with LPC55S69. A ready to use package for using the “Basic Discovery Loop” example from the NFC Reader Library with LPC55S69 and CLRC663 plus frontend is attached with this document. This document is structured as follows: Overview of LPC55S69: The LPCXpresso55S69 development board provides the ideal platform for evaluation of and development with the LPC55S6x MCU based on the Arm® Cortex®-M33 architecture. The board includes a high performance onboard debug probe, audio subsystem and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, displays and other interfaces. The LPCXpresso55S69 is fully supported by the MCUXpresso suite of tools, which provides device drivers, middleware and examples to allow rapid development, plus configuration tools and an optional free IDE. MCUXpresso software is compatible with tools from popular tool vendors such as Arm and IAR, and the LPCXpresso55S69 may also be used with the popular debug probes available from SEGGER and P&E Micro. Hardware Requirements: Following hardware is required to run the project: LPC55S69-EVK development board. CLEV6630B board or BLE-NFC-V2 board. BLE-NFC-V2: It is easier to use the BLE-NFC-V2 board since it can be just plugged on top of the arduino interface available on the LPCXpresso55S69 board. The following figure shows the pin mapping between the two boards. CLEV6630B board: The CLEV6630B board consists of CLRC663 plus (NFC frontend) connected by default to an LPC1769 µC via SPI. However, the board is made in such a way that the LPC1769 MCU can be bypassed to connect to an external MCU (in our case the LPC55S69) easily. For doing so: Six resistors from the board need to be removed. These are highlighted in red in the Figure 1: Use the SPI pin connectors available on the left-hand side, on the board edge to connect to external MCU (LPC55S69 in this case) Solder jumper wires onto the following pins of CLEV6630B Board:  GND IRQ CLRC_NRST SSEL MOSI MISO SCK IF0 IF1      The CLEV6630B is shown in Figure 2 after the required changes have been made to it (Removal of resistors and soldering of wires).   Now connect the two boards as follows:   Running Basic Discovery Loop on LPC55S69:   If this is the first time you’re using LPC55S69-EVK board, follow the getting started guide first à  LPC55S69-EVK | NXP . Make sure to install the SDK package for LPC55S69-EVKboard which is required for the project below to run. Download either‘lpcxpresso55s69_BasicDiscoveryLoop_CLEV6630b' or ' lpcxpresso55s69_BasicDiscoveryLoop_BLE-NFC ' 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 Debug icon from the Quickstart panel to begin a debug session. Once the debug session has started, click on the run icon to run the code: The project should be running now. The project contains basic discovery loop functionality. Here is how the output looks like in the terminal. Bring any NFC card near the frontend’s antenna and the output console will show the detection and type of the card. For example, in the picture below, we can see that type 4A card was detected:     Running other NFC Reader Library examples on LPC55S69: Once the “lpcxpresso55s69_BasicDiscoveryLoop” project is running on the LPC55S69. Running other examples from is simple. First step is to install the NFC Reader Library : Installing the NFC Reader Library: Go to www.nxp.com/pages/:NFC-READER-LIBRARY Go to the Downloads tab and click on the download button Click download on the NFC Reader Library for Kinetis K82F package. Import the library package in the workspace. The easiest way is to use the Quick Start Panel on the left-hand side: Click on Import project from file system Then, browse the library package in your file system. Click Finish to import it all to your workspace. After completing the import wizard, all projects are listed in the “Project Explorer” window. As can be seen in the screenshot, it contains different folders: API documentation folder Driver Abstraction Layer FreeRTOS support The platform support (in the screenshot, corresponding to the LPC support) The software examples  The Reader Library implementation And the OS abstraction layer   Running "NfcrdlibEx9_NTagI2C" on LPC55S69: Here we use the “NfcrdlibEx9_NTagI2C” example from the reader library to describe the method. The same method can be used to run other examples from the NFC Reader Library.  To run "NfcrdlibEx9_NTagI2C" on LPC55S69, we look at " lpcxpresso55s69_BasicDiscoveryLoop" project (available as a download below) and "NfcrdlibEx9_NTagI2C" project (from the Reader Library). We make changes to the following folders: In “intfs” folder remove everything except the “phaApp_Init.h” file. Then go to the “intfs” folder of the NFC Reader Library example you want to run (“NfcrdlibEx9_NTagI2C” in this case), and copy all the files except “phaApp_Init.h” and paste them in the original “intfs” folder. In line 57 of the “ph_NxpBuild_App.h” file in “intfs” folder, replace #if defined(PHDRIVER_LPC1769RC663_BOARD) \     || defined(PHDRIVER_FRDM_K82FRC663_BOARD)\ #   define NXPBUILD__PHHAL_HW_RC663 #endif with #if defined(PHDRIVER_LPC1769RC663_BOARD) \     || defined(PHDRIVER_FRDM_K82FRC663_BOARD)\     || defined(PHDRIVER_LPC55S69RC663_BOARD) #   define NXPBUILD__PHHAL_HW_RC663 #endif Go to “source” folder and remove every file except “phApp_Init.c“ and “semihost_hardfault.c” files. Then go to “src” folder of the example you want to run (“NfcrdlibEx9_NTagI2C” in this case) and copy all the files except “phaApp_Init.c” and paste them into the “source” folder. Finally, copy the main file of the example you want to run (NfcrdlibEx9_NTagI2C in this case) and paste it into the “source” folder as well. The project is ready to build and run on LPC55S69.       Available Resources: Porting NFC Reader Library to i.MX RT1050. (Detailed Description of porting) https://community.nxp.com/docs/DOC-341843 LPC55S69 https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc5500-cortex-m33/lpcxpresso55s69-development-board:LPC55S69-EVK BLE-NFC-V2 https://www.nxp.com/products/identification-security/rfid/nfc-hf/nfc-readers/clrc663-iplus-i-and-qn902x-nfc-bluetooth-low-energy-solution-for-consumer-applications:BLE-NFC
View full article
This post contains a step by step guide of how to use PN7150 with LPC55S69.  This document is structured as follows: Overview of PN7150:  The PN7150 is a Plug-and-Play all-in-one NFC solution for easy integration into any OS environment like Linux and Android, reducing Bill of Material (BoM) size and cost. The embedded Arm® Cortex®-M0 microcontroller core is loaded with the integrated firmware, simplifying the implementation as all the NFC real-time constraints, protocols and the device discovery (polling loop) are processed internally. In few NCI commands, the host SW can configure the PN7150 to notify for card or peer detection and start communicating with them. It has the following salient features: Full NFC forum compliancy with small form factor antenna Embedded NFC firmware providing all NFC protocols as pre-integrated feature Direct connection to the main host or microcontroller, by I2C-bus physical and NCI protocol Ultra-low power consumption in polling loop mode Highly efficient integrated power management unit (PMU) allowing direct supply from a Battery Overview of LPC55S69:  The LPCXpresso55S69 development board provides the ideal platform for evaluation of and development with the LPC55S6x MCU based on the Arm® Cortex®-M33 architecture. The board includes a high performance onboard debug probe, audio subsystem and accelerometer, with several options for adding off-the-shelf add-on boards for networking, sensors, displays and other interfaces. The LPCXpresso55S69 is fully supported by the MCUXpresso suite of tools, which provides device drivers, middleware and examples to allow rapid development, plus configuration tools and an optional free IDE. MCUXpresso software is compatible with tools from popular tool vendors such as Arm and IAR, and the LPCXpresso55S69 may also be used with the popular debug probes available from SEGGER and P&E Micro. Hardware requirements: OM5578/PN7150ARD  LPCXpresso55S69 + usb  micro cable  Using PN7150 with LPC55S69-EVK: Hardware Connections: The hardware connections are simple. Both the LPC55S69-EVK board and OM5578/PN7150ARD board have an Arduino interface. So, mount the PN7150ARD board with male Arduino connector onto the female Arduino connector of the LPC55S69-EVK board. Running the demo: If this is the first time you’re using LPC55S69-EVK board, follow the getting started guide first à  LPC55S69-EVK | NXP . Make sure to install the SDK package for LPC55S69-EVKboard which is required for the project below to run. Download the ‘NXP-NCI_PN7150_LPC55xx_example’ 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 by clicking here: Now that the package has been imported to the MCUXpresso IDE (via drag and drop), click on Debug icon from the Quickstart panel to begin a debug session. Once the debug session has started, click on the run icon to run the code: The project should be running now. The project contains basic discovery loop functionality. Here is how the output looks in the console tab on MCUXpresso: Bring any NFC card near the PN7150 board’s antenna and the output console will show the detection and type of the card. For example, in the picture below, we can see that type 4 card was detected: Available Resources: AN11990 NXP-NCI MCUXpresso example document. (https://www.nxp.com/docs/en/application-note/AN11990.pdf) The example project explained in this project was ported to LPC55S69 using section 5.3 and 6 of the above mentioned document. PN7150 datasheet (https://www.nxp.com/docs/en/data-sheet/PN7150.pdf) PN7150 User Manual (https://www.nxp.com/docs/en/user-guide/UM10936.pdf) PN7150 NFC Controller SBC Kit User Manual  (https://www.nxp.com/docs/en/user-guide/UM10935.pdf)
View full article