AnsweredAssumed Answered

PN7150 library (SW4325) has a problem in nfctask.c

Question asked by Colin Gerrish on May 2, 2019
Latest reply on May 14, 2019 by Colin Gerrish

I've been working through the PN7150 code library, which is available in the SW4325 zip file as per Application Note AN11990.

 

I found I was having some intermittent problems when testing card Read mode, in particular with MIFARE classic cards.

 

I discovered the problem resides in nfctask.c in function "void task_nfc_reader(NxpNci_RfIntf_t RfIntf)".

 

Here, I discovered that after the message "CARD REMOVED\r\n" there are two further functions calls but there is no error checking associated with these calls and so if and when there is an error, I found that my PN7150 halts and then requires a hard reboot. Not ideal!

 

I found that with the MIFARE classic card it is sometimes returning a NXPNCI_ERROR instead of a NXPNCI_SUCCESS.

 

I found that if I change this function and repeat the call if a NXPNCI_ERROR is returned it appears to fix the problem. As in:

 

if (NxpNci_StartDiscovery(DiscoveryTechnologies,sizeof(DiscoveryTechnologies))) {
// try again - note I inserted a short Sleep/delay call here
// just to be sure but probably its not required
if (NxpNci_StartDiscovery(DiscoveryTechnologies,sizeof(DiscoveryTechnologies)))
printf("Discovery Start Error\r\n");
}

 

 

Thus, ideally, the function task_nfc_reader should also be amended to also return NXPNCI_SUCCESS or NXPNCI_ERROR

Outcomes