Unable to discover NFC tags using PN7161

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

Unable to discover NFC tags using PN7161

504 Views
nikhilkomalan
Contributor I

Hello Developers,

We are currently developing a product, in which we are currently interfacing STM32 controller with NXP's PN7161 NFC reader to write/read data to/from ST25DV04KC dynamic tags (IS015693). We have referred the example code "nfc_example_RW.c" from the latest firmware "SW6705" as referrence for developing our firmware.

 

Below is the NFC settings we are using for our NFC example: 

I have just changed the the NXP_TVDD_CONF to 1 as the VDD is 3.3V. 

 

 

 

/***** NFC dedicated setting ****************************************/

/* Following definitions specifies which settings will apply when NxpNci_ConfigureSettings()
 * API is called from the application
 */
#define NXP_CORE_CONF        1
#define NXP_CORE_STANDBY     1
#define NXP_CORE_CONF_EXTN   1
#define NXP_CLK_CONF         1 // 1=Xtal, 2=PLL
#define NXP_TVDD_CONF        1 // 1=3.3V, 2=4.75V
#define NXP_RF_CONF          1

uint8_t NxpNci_SettingCurrentTS[32] = __TIMESTAMP__;

#if NXP_CORE_CONF
/* NCI standard dedicated settings
 * Refer to NFC Forum NCI standard for more details
 */
uint8_t NxpNci_CORE_CONF[]={0x20, 0x02, 0x05, 0x01,         /* CORE_SET_CONFIG_CMD */
    0x00, 0x02, 0xFE, 0x01                                  /* TOTAL_DURATION */
};
#endif

#if NXP_CORE_CONF_EXTN
/* NXP-NCI extension dedicated setting
 * Refer to NFC controller User Manual for more details
 */
uint8_t NxpNci_CORE_CONF_EXTN[]={0x20, 0x02, 0x05, 0x01,    /* CORE_SET_CONFIG_CMD */
    0xA0, 0x40, 0x01, 0x00                                  /* TAG_DETECTOR_CFG */
};
#endif

#if NXP_CORE_STANDBY
/* NXP-NCI standby enable setting
 * Refer to NFC controller User Manual for more details
 */
uint8_t NxpNci_CORE_STANDBY[]={0x2F, 0x00, 0x01, 0x00};    /* last byte indicates enable/disable */
#endif

#if NXP_CLK_CONF
/* NXP-NCI CLOCK configuration
 * Refer to NFC controller Hardware Design Guide document for more details
 */
 #if (NXP_CLK_CONF == 1)
 /* Xtal configuration */
 uint8_t NxpNci_CLK_CONF[]={0x20, 0x02, 0x05, 0x01,        /* CORE_SET_CONFIG_CMD */
   0xA0, 0x03, 0x01, 0x08                                  /* CLOCK_SEL_CFG */
 };
 #else
 /* PLL configuration */
 uint8_t NxpNci_CLK_CONF[]={0x20, 0x02, 0x09, 0x02,        /* CORE_SET_CONFIG_CMD */
   0xA0, 0x03, 0x01, 0x11,                                 /* CLOCK_SEL_CFG */
   0xA0, 0x04, 0x01, 0x01                                  /* CLOCK_TO_CFG */
 };
 #endif
#endif

#if NXP_TVDD_CONF
/* NXP-NCI TVDD configuration
 * Refer to NFC controller Hardware Design Guide document for more details
 */
 #if (NXP_TVDD_CONF == 1)
 /* TXLDO output voltage set to 3.3V */
 uint8_t NxpNci_TVDD_CONF[]={0x20, 0x02, 0x0F, 0x01, 0xA0, 0x0E, 0x0B, 0x11, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0xD0, 0x0C};
 #else
 /* TXLDO output voltage set to 4.75V */
 uint8_t NxpNci_TVDD_CONF[]={0x20, 0x02, 0x0F, 0x01, 0xA0, 0x0E, 0x0B, 0x11, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0xD0, 0x0C};
 #endif
#endif

#if NXP_RF_CONF
/* NXP-NCI RF configuration
 * Refer to NFC controller Antenna Design and Tuning Guidelines document for more details
 */
/* Following configuration relates to performance optimization of OM27160 NFC Controller demo kit */
uint8_t NxpNci_RF_CONF[]={0x20, 0x02, 0x4C, 0x09,
  0xA0, 0x0D, 0x03, 0x78, 0x0D, 0x02,
  0xA0, 0x0D, 0x03, 0x78, 0x14, 0x02,
  0xA0, 0x0D, 0x06, 0x4C, 0x44, 0x65, 0x09, 0x00, 0x00,
  0xA0, 0x0D, 0x06, 0x4C, 0x2D, 0x05, 0x35, 0x1E, 0x01,
  0xA0, 0x0D, 0x06, 0x82, 0x4A, 0x55, 0x07, 0x00, 0x07,
  0xA0, 0x0D, 0x06, 0x44, 0x44, 0x03, 0x04, 0xC4, 0x00,
  0xA0, 0x0D, 0x06, 0x46, 0x30, 0x50, 0x00, 0x18, 0x00,
  0xA0, 0x0D, 0x06, 0x48, 0x30, 0x50, 0x00, 0x18, 0x00,
  0xA0, 0x0D, 0x06, 0x4A, 0x30, 0x50, 0x00, 0x08, 0x00
};
#endif

 

 

 

 

 

 

Issue: 

I am able to successfully connect to NXPNci device, configure its settings, mode (NXPNCI_MODE_RW) and also able to start discovery procedure with technologies selected as TECH_PASSIVE_15693 in Polling mode.

Code Reference: 

 

 

/* Discovery loop configuration according to the targeted modes of operation */
unsigned char DiscoveryTechnologies[] = {
    MODE_POLL | TECH_PASSIVE_15693,
};


    /* Open connection to NXPNCI device */
    if (NxpNci_Connect() == NFC_ERROR) {
        printf("Error: cannot connect to NXPNCI device\n");
        return;
    }

    if (NxpNci_ConfigureSettings() == NFC_ERROR) {
    	printf("Error: cannot configure NXPNCI settings\n");
        return;
    }

    if (NxpNci_ConfigureMode(NXPNCI_MODE_RW) == NFC_ERROR)
    {
    	printf("Error: cannot configure NXPNCI\n");
        return;
    }

    /* Start Discovery */
    if (NxpNci_StartDiscovery(DiscoveryTechnologies,sizeof(DiscoveryTechnologies)) != NFC_SUCCESS)
    {
    	printf("Error: cannot start discovery\n");
        return;
    }

 

 

 

But when i bring ST25DV04KC tag near reader RF field, the discovery process is unable to discover the tag. We have also tried using other passive tags but still unable to get any discovery notification.   

 

In NxpNci_WaitForDiscoveryNotification we get stuck at the following code snippet, the response we are receiving is 0x61 0x23 0x00 but it requires first 2nd byte to be 0x03. 

 

 

    do
    {
        if(NxpNci_WaitForReception(Answer, sizeof(Answer), &AnswerSize, TIMEOUT_INFINITE) == NXPNCI_ERROR) return NXPNCI_ERROR;
    }while ((Answer[0] != 0x61) || ((Answer[1] != 0x05) && (Answer[1] != 0x03)));

 

 

 

Below i have given the NCI Debug logs for referrence: 

 

 

[18:03:28:032] PN7160 interfacing code
[18:03:28:290] Scanning I2C bus:
[18:03:28:340] ---------------------------------------0x28-----------------------------------------------------------------------------------0x7C---
[18:03:30:659] NCI >> 20 00 01 01 
[18:03:30:712] NCI << 40 00 01 00 
[18:03:30:719] NCI << 60 00 09 02 01 20 04 04 71 12 50 05 
[18:03:30:721] Firmware Version: 12.50.5
[18:03:30:734] NCI >> 20 01 02 00 00 
[18:03:30:753] NCI << 40 01 1e 00 1a 7e 06 03 01 d0 02 ff ff 01 ff 00 08 00 00 01 00 02 00 03 00 80 00 82 00 83 ...
[18:03:31:814] NCI >> 2f 00 01 00 
[18:03:31:827] NCI << 4f 00 01 00 
[18:03:31:841] NCI >> 20 02 05 01 00 02 fe 01 
[18:03:31:856] NCI << 40 02 02 00 00 
[18:03:31:870] NCI >> 20 03 03 01 a0 14 
[18:03:31:890] NCI << 40 03 25 00 01 a0 14 20 57 65 64 20 41 70 72 20 32 36 20 31 37 3a 31 35 3a 35 39 20 32 30 ...
[18:03:31:910] NCI >> 20 02 05 01 a0 40 01 00 
[18:03:31:925] NCI << 40 02 02 00 00 
[18:03:31:939] NCI >> 20 02 05 01 a0 03 01 08 
[18:03:31:954] NCI << 40 02 02 00 00 
[18:03:31:970] NCI >> 20 02 0f 01 a0 0e 0b 11 01 01 01 00 00 00 10 00 d0 0c 
[18:03:31:987] NCI << 40 02 02 00 00 
[18:03:32:009] NCI >> 20 02 4c 09 a0 0d 03 78 0d 02 a0 0d 03 78 14 02 a0 0d 06 4c 44 65 09 00 00 a0 0d 06 4c 2d ...
[18:03:32:030] NCI << 40 02 02 00 00 
[18:03:32:052] NCI >> 20 02 24 01 a0 14 20 57 65 64 20 41 70 72 20 32 36 20 31 37 3a 31 35 3a 35 39 20 32 30 32 ...
[18:03:32:082] NCI << 40 02 02 00 00 
[18:03:32:082] NCI >> 20 00 01 00 
[18:03:32:105] NCI << 40 00 01 00 
[18:03:32:105] NCI << 60 00 09 02 00 20 04 04 71 12 50 05 
[18:03:32:114] NCI >> 20 01 02 00 00 
[18:03:32:132] NCI << 40 01 1e 00 1a 7e 06 03 01 d0 02 ff ff 01 ff 00 08 00 00 01 00 02 00 03 00 80 00 82 00 83 ...
[18:03:33:282] NCI >> 2f 02 00 
[18:03:33:295] NCI << 4f 02 05 00 00 01 aa dd 
[18:03:33:312] NCI >> 21 00 10 05 01 01 01 02 01 01 03 01 01 04 01 02 80 01 80 
[18:03:33:330] NCI << 41 00 01 00 
[18:03:34:595] NCI >> 21 03 03 01 06 01 
[18:03:34:609] NCI << 41 03 01 00 
[18:03:36:797] 
[18:03:36:808] WAITING FOR DEVICE DISCOVERY
[18:03:37:296] NCI << 61 23 00 
[18:03:37:306] NCI << 61 23 00 
[18:03:37:306] NCI << 61 23 00 
[18:03:37:306] NCI << 61 23 00 
[18:03:37:306] NCI << 61 23 00 
[18:03:37:322] NCI << 61 23 00 

 

 

 

So can anyone please help me with this issue  of unable to discover ISO15693 based NFC tags in RW mode. 

 

Thanks in advance. 

 

 

 

 

 

 

Labels (1)
0 Kudos
1 Reply

357 Views
Tomas_Parizek
NXP Employee
NXP Employee

Hello nikhilkomalan, 

 

See our AN13892 document -> 9 TXLDO check. It looks like this issue: 

Tomas_Parizek_0-1687507349079.png

BR

Tomas 

0 Kudos