NXP NFC LIB PH_ERR_PROTOCOL_ERROR reading emulated Type 4A tag

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

NXP NFC LIB PH_ERR_PROTOCOL_ERROR reading emulated Type 4A tag

779 Views
rciordia
Contributor I

Hi everyone,

We have implemented a fw in one of our boards that works with the NXP NFC library (NFCRDLIB_V4.010.03.001609 in particular).

This fw works as a reader which communicates with smartphones via NFC using P2P communication (Android Beam). Also this fw is capable of read mifare classic cards and parade cards.

Since in Android Q is no longer using Android Beam, we have to move the NFC communication with the smartphones from Android Beam to HCE.

We have migrated our app from Android Beam to HCE and once we approach the phone to our board we detect the phone as a defire card.

But we are not able to read the data the app is sending.

We have debug both (app and fw from the board) an we see that we get an error: PH_ERR_PROTOCOL_ERROR from the fw part. And from the app part we see that we are waiting to get a response from the board in order to send later the data.

Going deep in the board code, we see that we are able to:

1.Get the UID and its size: sDiscLoop.sTypeATargetInfo.aTypeA_I3P3 [0]

2.Retrieve 1443-4A protocol parameters: phpalI14443p4a_GetProtocolParams

3.-Set 14443-A protocol parameter: phpalI14443p4_SetProtocol

4.-Load keys in the Keys store: phKeyStore_FormatKeyEntry

5.-Set the keys: phKeyStore_SetKey

6.-Select App: phalMfdf_SelectApplication

7.- Authenticate: phalMfdf_AuthenticateAES

But when it comes to read the data with the function : halMfdf_ReadData. We got the error:

#define PH_COMP_AL_MFDF 0x1900U / ** <MIFARE DESFIRE EV1 AL Component Code. * /
#define PH_ERR_PROTOCOL_ERROR 0x0006U / ** <Received response violates protocol. * /

First we thought that we were no compliant with the APDU format the smartphone sends when it is in HCE mode. But going deep to the last function we see that the APDU handling is wrapped into this function. Having the error in the function: phalMfdf_Sw_Int_GetData from the phalMfdf_Sw_int.c.

At this point we are not able to know from where the error comes: phone or board firmware.

Do you have the same problems? Could anyone give us some hints or clues so we can continue?

Thanks in advance for your help.

 

0 Kudos
2 Replies

761 Views
jimmychan
NXP TechSupport
NXP TechSupport

Could you tell me which chip are you using? (what is the part number?)

Are you download the library from here?

https://www.nxp.com/design/designs/nfc-reader-library-software-support-for-nfc-frontend-solutions:NF...

 

0 Kudos

726 Views
rciordia
Contributor I

HI,


First of all thanks for your interest.


We are using the PN512 with part number: N5120A0HN1


And the library was dowloaded form NXP website (see NxppRdLib_Ver.h below):

ifndef NXPRDLIB_VERSION_INFO_H_INCLUDED
#define NXPRDLIB_VERSION_INFO_H_INCLUDED


/*
* Copyright (c), NXP Semiconductors
*
* (C)NXP Semiconductors
* All rights are reserved. Reproduction in whole or in part is
* prohibited without the written consent of the copyright owner.
* NXP reserves the right to make changes without notice at any time.
* NXP makes no warranty, expressed, implied or statutory, including but
* not limited to any implied warranty of merchantability or fitness for any
*particular purpose, or that the use will not infringe any third party patent,
* copyright or trademark. NXP must not be liable for any loss or damage
* arising from its use.
*/
/*
* Version Information
* Auto-Generated by:
* docs\22_rel_doc\version_update.py (v2014.07.20_00)
*
* Do not edit this file. Update version_info.txt instead. */


#define NxpRdLib_VER_FILEDESCRIPTION "NxpRdLib_4.010.03.001609_ExC"
#define NxpRdLib_VER_FILEVERSION 4.010.03.001609
#define NxpRdLib_VER_FILEVERSION_STR "4.010.03.001609"
#define NxpRdLib_VER_PRODUCTVERSION 4.010.03.001609
#define NxpRdLib_VER_PRODUCTVERSION_STR "4.010.03.001609"
#define NxpRdLib_VER_PRODUCT_STREAM (4)
#define NxpRdLib_VER_MAJOR (1)
#define NxpRdLib_VER_MINOR (03)
#define NxpRdLib_VER_DEV (1609)

/* ______GENERATED_FROM____version_info.txt
* # _____________________________________________________________________________
* # Product Description
* #
* sw_c_define_name = "NxpRdLib"
* sw_product_name = "NxpRdLib" # Product Name
* sw_cs_namespace = "NxpRdLibNet" # C# Namespace
* rd_lib_stream = "06" # PN7462AU Flavour
* # NN => Release No.
* # X => 0 : Library w/o Crypto components
* # 1 : Library with Crypto components
* # 2 : Library with Crypto components - Internal usage only.
* #
* sw_v_major = "010" # Major Release NNX
* sw_v_minor = "01" # SW Minor Version
* sw_v_dev = "00" # SW Development Version
* sw_maturity = "B" # SW Maturity "A" Alpha, "B":Beta, "P": Production
* sw_metastring = "uHost" # Any meta string
* # _____________________________________________________________________________
* #
* # History: Descending
* #
* # 06.010.01.00 : Corresponding to PN7462AUFlash_00.02.00_Dev_20140808
* # 06.010.00.00 : Migrated to UHost/DUT based NxpRdLib
* # 06.000.01.00 : Intial Release
* # _____________________________________________________________________________
*/


#endif /* NXPRDLIB_VERSION_INFO_H_INCLUDED */

Best regards.

 

0 Kudos